Search Unity

Hovering flight behavior scripting help

Discussion in 'Scripting' started by B-Nix, May 31, 2011.

  1. B-Nix

    B-Nix

    Joined:
    Feb 27, 2011
    Posts:
    3
    Hi all,

    I'm really new to Unity and I'm trying my hand at making a game I've been thinking about for a long time.

    I'm making a third person arcade style flying combat game. I'm currently working on hovering controls (think helicopter) for the ship. In order to give the game a more arcadey feel, I'm not using physics based controls. What I'm having trouble with currently is adding the ability to strafe.

    I'm currently using the following simple line of code:

    transform.Translate(Time.deltaTime*10*rightleftsoftstrafe,0,0);

    It works to make the ship strafe while level, but the problem is that the ships banks when it turns, so if I try to stafe while turning, the ship strafes up or down at the angle the ship is banked. How do I make it always strafe parallel to the ground?

    Thanks for any help!