How do you properly use :VectorToWorldSpace() with a BodyAngularVelocity

I’m making a flying vehicle, but can’t seem to figure out how :VectorToWorldSpace() works. Currently, when I do try to use it, it flings the vehicle all over the place. It didn’t do that before.

angular.AngularVelocity = Vector3.new(primaryPart.CFrame:VectorToWorldSpace(primaryPart.CFrame.Position).X-10,angular.AngularVelocity.Y,angular.AngularVelocity.Z)

If anybody could help and possibly give me a code example, that’d be awesome!

World space is based off the origin, so it is where is this position relative to (0,0,0).
Object space is based off an object. So where is that position relative to the position of some object.

Hope thats help!

Yeah, I’m aware of that. I’m just wondering how I use :VectorToWorldSpace() along with a BodyAngularVelocity.

VectorToWorldSpace is the same as:

(CFrame1 - CFrame1.p) * v3

i guess you could use it here, but there is a more efficient way called LookVector.

part.CFrame.LookVector

is the same as

part.CFrame:VectorToWorldSpace(Vector3.new(0, 0, -1))

one way you could do it is:

angular.AngularVelocity = primaryPart.CFrame.LookVector * speed

another way that does the exact same thing looks like this:

angular.AngularVelocity = primaryPart.CFrame:VectorToWorldSpace(Vector3.new(0, 0, -1)) * speed
...
print( workspace.Part.CFrame.LookVector == workspace.Part.CFrame:VectorToWorldSpace(Vector3.new(0,0,-1)) ) -- prints true
2 Likes