Need help transfering Body Velocity To Angular Velocity

Hello, so I was making a player guided missile and soon realised once I change the CFrame of the missile, the BodyVelocity that I had in the missile did not adjust to the new CFrame, i was told that this is because it is relative to the world and not the object. So someone told me to use AngularVelocity, but I don’t know where to start, can anyone help?

Here is my body velocity code.
https://gyazo.com/13a45d29baa59b6486374420fce01b5c

MissileCopy.Main.Velocity = Vector3.new(200, 0, 200) * MissileCopy.CFrame.LookVector
MissileCopy.Main.MaxForce = Vector3.new(500, 700, 500)

Unless I’m missing something, I think you could just do the following:

local maxVelocity = 200
local maxForce = 500
-- The LookVector is already a unit vector by default, meaning we can multiply by a number and that would be the missile’s maximum velocity
MissileCopy.Main.Velocity = MissileCopy.CFrame.LookVector * maxVelocity
MissileCopy.Main.MaxForce = Vector3.new(maxForce, maxForce, maxForce)
-- There’s no reason to have the max force be different in different directions unless you’re trying to make the missile *accelerate* faster in one direction, which would likely look odd for your use case

I think BodyVelocity is either deprecated or legacy so you may want to use LinearVelocity.

What is the solving, I don’t understand? It does the same thing, just doesn’t change direction when I use CFrame still.

So the missile’s LookVector would be for the missile to go straight. You would just replace the missile’s LookVector with a unit vector representing the player’s desired direction. So if you use the player’s camera direction, I think you can just use the player’s camera LookVector instead of the missile’s LookVector.

I think Roblox removed BodyVelocity. As for your question:

Pretend you have a part that you want to go straight with LinearVelocity.

No matter what orientation the part has, it will always go the same direction. That’s because it’s relative to the world.

If you set it relative to attachment0, the part will move the same direction as the attachment.

Now when you orientate the part, the attachment orientates with it. So, the part will always go the direction of where its looking.

You can try this by adding a LinearVelocity to a part and playing with its RelativeTo property.

When I use a linearVelocity how would I make it not keeping going down, basically elimate the downward force?

Yeah, if you go to Model and turn on Constraint Details the LinearVelocity will show a blue arrow. This tells you which direction the part is moving toward.

I got it to go forward which is good, but I don’t know how to get it to not change on the Y value, anchoring it doesn’t work, here is what I mean. https://medal.tv/games/roblox-studio/clips/i1qyDz4XzB3Wx/d1337OL13DbN?invite=cr-MSwwcmYsMzg1NzgyMTEs

Increase the MaxForce, it seems like there’s not enough force applied and it’s making gravity take control.

I have it relative to the attachment, no matter which one I increase, it just spins.

Do you have any other constraints attached to it? Try putting an angular velocity on it and increasing the max torque of the angular velocity to 100,000. Keep the angular velocity property to vector3.new(0,0,0)

when I did that it did fix an issue but now it still doesnt float. https://medal.tv/games/roblox-studio/clips/i1yGhhGygcU-F/d1337nzCbt1T?invite=cr-MSxDZ1gsMzg1NzgyMTEs

Did you check if the blue arrow of the linear velocity is pointing forward? If yes and it still doesn’t work, try increasing the MaxForce property under the Linear Velocity to 100,000

I can do it for you when I have access to my PC if you want. I’ll publish it as a model and all you have to do is download it and then go to Toolbox > MyModels and click on it

If you could that would be helpful but this is what I have right now.

It looks like it’s pointing in the right direction. I think it’s because you set it relative to world. Try changing it to relative to. Attachment0

It is on relative, here is the file so you can take a look when you are at your computer.
Missile.rbxm (26.3 KB)

1 Like

Here are two versions, the first uses a fixed speed and the second uses force:

Missile.obj (245.2 KB)

Missile (2).obj (245.2 KB)

Hey man, those are object file Just send me the place file. haha

My bad lol, here:

Missile.rbxm (26.6 KB)

Missile.rbxm (27.1 KB)