AddForce and Rigibodies

I’m new to Unity, as this question will probably show.

I have a rigibody object that is in free-fall - imagine a parachuter, with the camera looking down on him as he falls to earth. I want to be able to have the user control which direction he moves in. I like using the rigidbody as it does what I need in terms of gravity.

In LastUpdate, I use GetAxis to retrieve the input, then use it with AddForce to nudge the object in a given direction during it’s descent. It sort of works, but has these problems:

  1. I’d like the movement in different directions to be a little bit more noticable.
  2. If I nudge too much in a direction, the terrain “spins” below; I’ve tried to freeze the rotation but that didn’t work.
  3. When I click the left and right arrows, it rotates the object rather than move it left or right (so now, it has a flight sim feel, when I’d rather it just move the object in the direction without rotation).

Any help would be greatly appreciated, thanks.

Could you post your script (or the relevant part of it)? It’s hard for me to picture everything it might be doing without seeing the code.

Actually, come to think of it, how is your camera set up to follow the parachuter? If it’s just parented to the falling object you wouldn’t be able to see much lateral movement at all, because it’s not moving relative to the camera. Just one thought, anyway.

The parachuter is being dropped from a high altitude and his landing spot is not far off from where he started, even if I apply the arrow keys during his whole descent. It’d be nice if a tap of an arrow key got him started on a slightly altered tangent in that direction (but still subject to gravity). Here is the simple script I tried:

var speed = 1000.0;

function LateUpdate()
{
rigidbody.freezeRotation = true;

var vert = Input.GetAxis (“Vertical”) * Time.deltaTime * speed;
var horz = Input.GetAxis (“Horizontal”) * Time.deltaTime * speed;

rigidbody.AddForce(Vector3.forward * vert);
rigidbody.AddForce(Vector3.right * horz);

//transform.Translate(horz, vert, 0);
}

Thanks!

I just tried adding your script to a cube with a rigidbody in an empty scene, and it worked perfectly, so I’m kind of at a loss for what the problem might be.

The spinning mentioned in your first post seems like it would be the camera, since the rigidbody shouldn’t start spinning unless torque is applied.

As for the distance it travels, that should just be up to your ‘speed’ variable.

Actually, now that I think of it, what is the mass of your parachuter’s rigidbody? On the cube I tested it on it was just 1, but if it were a lot higher than that it would cause it to move a lot less.