Control Camera Shooter Help
dmilinovichiii
Member Posts: 620
I'm really new to this so I need very precise directions. I am making a Geometry Wars game and I recently ran into a problem. The character moves using the arrow keys and shoots using the mouse. The problem is that when I shoot, the bullet doesn't go straight to the mouse. After experimenting, I figured out that it had something to do with it being a camera controlled game. The camera tracking area is 50 by 50, the scene size is 1000 by 1000, and I can provide any other info. I have already checked the other forum posts and the how to's and none of the solutions have worked for me.
Comments
Only an INSTANCE of an Actor in the Scene has access to the Camera data, NOT the prototype.
Create two global real attributes, cameraX and cameraY
Create a dummy box actor, call it something like Camera Tracker. Drag this actor into the scene, and place it just outside of the viewing area. Double-click on the Actor to edit it's Instance Properties. Click the padlock to access its behaviors.
Use two Constrain Attributes to keep track of Camera.Origin.X and Camera.Origin.Y in those global game attributes you created earlier.
You can now use game.cameraX and game.cameraY in your equations. (you'll need to add them to the Mouse Position to get the proper coordinates)