Gun Rotation Problem
trevorgolinar@outlook.com
Member Posts: 6
I am making a side scrolling zombie shooter and you control where the gun shoots with the mouse. The problem is whenever I pass the camera border the guns goes behind me player and I cant turn it back to its original position.
Comments
Point your gun to:
Mouse X + Camera Origin X
Mouse Y + Camera Origin Y
(Rather than just Mouse X, Mouse Y).
To access the Camera attributes the gun needs to be unlocked in the scene.
Alright thank you
@socks How do I make the gun stay with my player though?
You would constrain the gun to the player's X and Y. With an offset of course so that it looks like the player is holding the gun
How are you currently doing this ?
@socks I have constrain game.mouse.position.x to scene.camera.origin.x and game.mouse.position.y to scene.camera.origin.y
Does this make the gun stay with the player ?
@socks no
@Socks wouldn't you constrain the gun to the characters X and Y with an offset? That is how I would do it @trevorgolinar@outlook.com
Ok.
Who knows !?
You are the genius! No, I was asking because you have been here for a much longer time. @trevorgolinar@outlook.com You should use a constrain to player x and y to keep the gun following the player.
If by genius you mean 'one trick pony' then yes !
I have a question... If you are the 'one trick pony', how do you do so many tricks?
That's the art of being a one trick pony, present the same trick in different ways.