playMaker

Author Topic: Is there a way to take objects speed it?  (Read 2858 times)

naktim0819

  • Playmaker Newbie
  • *
  • Posts: 44
Is there a way to take objects speed it?
« on: March 07, 2013, 02:01:51 AM »
Is there a way to take objects speed it?

I need a force keep add on a object
Because he might hit something to slow down his speed
So that force must be sustained there has been.

But at last It will to fast  I need to catch
this object is to promote the speed to limit.

How do I find the speed value of the object is physically coupled it?


Thanks   u! :D
« Last Edit: March 07, 2013, 02:06:48 AM by naktim0819 »

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Is there a way to take objects speed it?
« Reply #1 on: March 07, 2013, 11:07:54 AM »
hey,
can you paraphrase (write the phrase with different words) this?
Quote
How I caught this object has been to promote speed?

Do you want to find out the speed of a moving rigidbody?
Best,
Sven

naktim0819

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Is there a way to take objects speed it?
« Reply #2 on: March 07, 2013, 11:16:01 AM »
oh sorry!!!!

When this object is "add force" after he was not generated a speed.
Per second speed increase up but he hit things will slow down because the physical
I want to catch this value to limit his most high-speed.
Maybe what you say!

I just do not understand that the value of I should be how to catch
Or what kind of things he is


kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Is there a way to take objects speed it?
« Reply #3 on: March 07, 2013, 12:36:42 PM »
ok, you can try this:

[STATE1]
"GetPosition" of your gameObject as Vector3 "First".
"Add Force" ... (every frame).
"sendEvent" delay : 0.1 seconds. Go to State2.

[STATE2]
In the next state again:
"GetPosition" of your gameObject as Vector3 "Second".
"Vector3 Operator" => "Second" - "First" = "SpeedVector"
"Get Vector3 Length" => "SpeedVector" to "Speed"
"float multiply" => "Speed" * 10 .
"SendEvent" go to STATE1 .

This gives you the speed of your gameObject.
You can do "Float Compare" in STATE2 with "Speed" . If Speed is high you can go to STATE3 :

[STATE3]
"wait" 0.1 . Go to STATE1 .

State3 = no "add force" for 0.1 sec. => gameObject is slower.

Does this help? What is your native language? Maybe I speak it.
« Last Edit: March 07, 2013, 12:38:40 PM by kiriri »
Best,
Sven

naktim0819

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Is there a way to take objects speed it?
« Reply #4 on: March 08, 2013, 10:07:47 AM »
Thank you! Success! Thank you for providing me a thinking mode!
I originally thought that the speed should be a value can be achieved!
But I learned a new way of thinking Thank you! I learn a lot!

Thx kiriri!!!!!!!!!!!!!

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: Is there a way to take objects speed it?
« Reply #5 on: March 08, 2013, 10:19:09 AM »
Ah great. The FSM works with any gameObject (rigidbody or not).

Something shorter (works only with rigidbody) :

"Get Velocity" + "Get Vector3 Length" . Both every frame.

Maybe this is easier ;)

Best,
Sven