Struggling with physics (LinearVelocity, BodyVelocity, VectorForce)

I’ve been struggling to get my assembly to move properly It’s a vehicle and I essentially am attempting to move the vehicle forward relative to it’s orientation. Although I cant work out what is the proper force to use, they all seem to have wacky quirks that I cant seem to fix. I’m brand new to working in the physics side of roblox, I mainly stick to working with anchored parts & code.

Linear Velocity has very nice & smooth linear movement, however it makes the vehicle ignore gravity.

Body Velocity is probably the closest one I’ve got to do what I want but, It’s deprecated.

I haven’t got Vector force to be able to move the object unless I set it to a high seemingly random number like 1800, which is really hard to fine toon.

There appears to be very little helpful documentation on the wiki, at most a sentence or two it’s really difficult for me to figure out what to do.

What is the suggested method to move an assembly & have it respond to physics interactions?

5 Likes

Can you add a video clip? Not sure what type of vehicle you are trying to make.

This is a good example of what I’m attempting to accomplish, However, they use body velocity, which is deprecated.

That is correct, you should use ‘LinearVelocity’ instead.

This is from the docs:

This object is deprecated and should not be used for new work. Use LinearVelocity instead.

Linear velocity doesn’t compensate for gravity at all. There’s probably a way I could calculate it myself, but it seems like a big work around to just using bodyVelocity.

1 Like

You can disable the force on the Y axis with the MaxForce property on LinearVelocity.

1 Like

To cancel out gravity, you can apply a vector force on Y axis, relative to attachment, that is equal to part.Mass*Workspace.Gravity

Pretty sure that ignores acceleration, I tested it out and it fell unrealistically linearly.

What do you mean ignores acceleration? The method I described makes the object unaffected by gravity, to explain simpler, the object will behave like objects in Cosmos, it will float in the air unless force is applied. When force is applied (in any direction), it will move very realistically, like the above mentioned object in space would.

What is the Vehicle you are making?
Building a Basic Car explains how to make a simple suspension vehicle that you can tune however you want with changes to HingeConstraints, SpringConstraints, Part masses, Friction, and the Forces applied on those Constraints.

My understanding is that LinearVelocity doesn’t apply a force, but it just sets the velocity of the object to that number. So giving it a velocity of -5 will just have it constantly have a velocity of -5. Meaning when it’s falling it will call at a constant rate. In roblox right when you start falling it’s slower then if you were falling for a while.

“In terms of what are the force numbers, studs?” :rofl: of course it’s newtons. (No wonder you found vectorforces weird to use)

I mean they never said the unit they used in the Dev-Hub at all, thanks for letting me know. By the way, I found the solution, LinearVelocity needs to be like this:
image

3 Likes

Can I ask why this needs to be like that?

Example code from dash problem

Explanation:

1 Like