x


Rigidbody player movement unrealistic velocity problem.

Hi. I am working on basic rigidbody player movement. I have tried this to move the player forward, but if I walk off a cliff I just walk on air while I am moving, but the velocity is local:

rigidbody.velocity = (transform.forward * moveSpeed * Time.deltaTime);

This does make the player fall off a cliff but it isn't local. So, how do I convert this to using local XYZ:

rigidbody.velocity.z = 100 * Time.deltaTime;

Thanks.

more ▼

asked Jul 19 '12 at 11:02 AM

JBoy gravatar image

JBoy
87 19 31 34

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-velocity.html

In most cases you should not modify the velocity directly, as this can result in unrealistic behaviour.

You should use physical forces instead to get the rigidbody moving.

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForce.html

more ▼

answered Jul 19 '12 at 11:16 PM

Doireth gravatar image

Doireth
602 4 7

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1794
x1370
x805
x318

asked: Jul 19 '12 at 11:02 AM

Seen: 406 times

Last Updated: Jul 19 '12 at 11:16 PM