x


Rigidbody magnitude

I've currently got a script that writes rigidbody.velocity.magnitude of an object to a GUI Text. But the speed it prints seems Very unreallistic, like my standard speed ( a constant relative force of 600) comes out as 20 in speed. What do i do to make the speed how it should be?

more ▼

asked Apr 22 '10 at 08:44 PM

Fishman92 gravatar image

Fishman92
2.4k 101 113 128

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

3 answers: sort voted first

If rigidbody.velocity.magnitude is giving you a result of 20, then that's what it is, you don't do anything. Force isn't speed, it's just force...e.g., using a force of 600 with an object that has a mass of 1 will give you completely different results compared to an object that has a mass of 1000.

more ▼

answered Apr 22 '10 at 09:09 PM

Eric5h5 gravatar image

Eric5h5
80.3k 41 132 521

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

Hard to know what "it should be", but presumably the velocity is in meters/second, so it may seem less than expected, e.g. 20 m/s = 72 kph = 44 mph.

more ▼

answered Apr 22 '10 at 09:02 PM

Molix gravatar image

Molix
4.8k 16 27 66

Actually, the velocity is in meters per frame. For framerate independent motion (meters/second), multiply your force by Time.deltaTime.

Apr 22 '10 at 09:17 PM e.bonneville

No, it's not. Velocity (and its magnitude) is in units per second.

Apr 22 '10 at 09:50 PM duck ♦♦

Oh, ok. I guess you learn something new every day. I revoted because I was wrong.

Apr 22 '10 at 10:36 PM e.bonneville
(comments are locked)
10|3000 characters needed characters left

Well, if your results are constantly 1/30 of the force you want to see, you could multiply your result by 30 before printing it. If it's constantly changing, then I can't help you.

more ▼

answered Apr 22 '10 at 08:53 PM

e.bonneville gravatar image

e.bonneville
5.7k 100 116 165

(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:

x1788
x357
x318
x28
x20

asked: Apr 22 '10 at 08:44 PM

Seen: 3541 times

Last Updated: Apr 22 '10 at 08:44 PM