Camera and Gun rotation

I am making a game in which the player uses a tank that has a gun that rotates to the mouse position and can fire bullets that have an arc to their flight path. THIS IS A SIDE SCROLLER kinda like mario.

I am having problems rotating the gun after I move beyond the Initial scene boundaries, because the scene is going to be massive, and I will need to have the camera follow the tank along.

I don't know exactly how to describe it, but the gun will rotate to point to the back of the screen, and if i stop to point the gun forward, the farthest it will move is to point directly upwards. If the tank returns to where the tank starts, the Gun will point to where the mouse is normally.

I don't know what to do about this, so please give me your best solution!

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    Point the gun at:

    Mouse x + camera origin x
    Mouse y + camera origin y

    You will need to unlock the gun to access the camera attributes.

Answers

  • Food BlenderFood Blender Member Posts: 3
    edited May 2015

    Is there a way to do this without unlocking the instance? I'd rather not have to change the gun in EVERY scene if i make more than 1 level

    Your instructions were helpful but i'm asking if there is another way.

  • Food BlenderFood Blender Member Posts: 3

    @Socks said:
    Point the gun at:

    Mouse x + camera origin x
    Mouse y + camera origin y

    You will need to unlock the gun to access the camera attributes.

    Your solution did not work.

  • SocksSocks London, UK.Member Posts: 12,822

    @Food Blender said:
    Your solution did not work

    Thanks for the feedback :)

Sign In or Register to comment.