playMaker

Author Topic: Rigidobdy has to stop to move at a location  (Read 793 times)

NewTo

  • Playmaker Newbie
  • *
  • Posts: 12
Rigidobdy has to stop to move at a location
« on: June 14, 2020, 08:21:42 AM »
Hello Playmakers,

I cannot figure how to stop my rigidbody correctly at a given position.
The goal is to stop a Rigidbody but not instantly, with something like braking.
I will give some details because of I may use the wrong tools without knowing it.

I have a rigidbody, Mass800, Drag 0, Angular Drag 0, it is something like a car and it is only moving on X and Z. it does not rotates.

I Pick a location to go, I ease floats on X and Z to reach max Velocity in 2s, it's the acceleration. I use Set Velocity to move.
Here is my rigidbody going to it's destination.

Now it has to stop to the almost exact location.
 I tried to use "ease floats" to ease the velocity down to 0 over a certain amount of time but when the rigidbody has to travel a little distance and do not have time to reach full speed then the stopping distance is different.
If I use a different car with another mass and another max velocity, it does not work well too.

I would like to know how I could do to make it stops at the right location over, let's say 2 units of distance or over 2 seconds.

Every tips would be appreciated ^^

Have a good day.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7620
    • jinxtergames
Re: Rigidobdy has to stop to move at a location
« Reply #1 on: June 14, 2020, 09:29:26 AM »
Hi.
If it needs to stop on a target position, maybe you could use something like 'Get Distance' to manipulate the velocity. (the closer you get the slower the velocity)
and maybe stopping the set velocity at a certain distance

NewTo

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Rigidobdy has to stop to move at a location
« Reply #2 on: June 14, 2020, 12:21:18 PM »
Hello Djaydino,

I was expecting some mathematic formulas involving time distance speed and stuff like that, I think that the way you are pointing at might be good.

I will give it a try.

Thanks !