Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Applying a sideways velocity?

Asked by
Eqicness 255 Moderation Voter
6 years ago
Edited 6 years ago

Hello. I'm scripting a hovercraft. I've got everything done, and it all works fine, but since I'm using a BodyThrust to move the vehicle, and a BodyPosition to keep it up (along with a BodyGyro and AngularVelocity, although those don't matter for this), it has no resistance, so it takes a very long time for velocity in certain directions to die down. So, when I turn, there's still velocity in my previous direction causing the vehicle to slide as if it's on ice.

EDIT: I now realize I need to apply a sideways force to the velocity, so my question now is: How do I get rid of the sliding, possibly by applying a sideways force to an object according to it's velocity?

Here's a game with my hovercraft for you to test:

(Ignore all the other assets & features) Hovercars

Thanks.

0
The game example didn't update for a second, it's all fixed and testable now. Eqicness 255 — 6y
0
"The permission levels on this place prevent you from entering." EnlightenedDev 11 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Use BodyVelocity to move the hovercraft. This will provide two benefits over using BodyThrust.

  1. You can set a target velocity directly, instead of having to calculate the thrust to reach a target. This will come in handy when you want to set a cap on how fast the hovercraft can go.
  2. When you want the hovercraft to slow down (towards 0 velocity), you can set the target velocity to Vector3.new(0, 0, 0) instead of having to calculate a thrust to negate the velocity when sliding.
0
Thank you, but I'm using a body thrust because it's relative and I'm using a body position to keep it upright. I'll experiment with body velocity. Eqicness 255 — 6y
1
Tried it out! It's working a bit better, still some sliding but that can be adjusted easily with the body velocity's properties. I thought Body Velocities would work totally weirdly with my hovercraft, I thought wrong! Eqicness 255 — 6y
Ad

Answer this question