How to use BodyGyro's to make something spin

The title says it all, I’m only trying to rotate a part because I am unable to tween it without ruining the script. I do not know how BodyGyro’s work, so any tips would be appreciated! Thanks

1 Like

If you can’t tween a part you could try using CFrame.FromEulerAnglesXYZ(), this would work with models too if you use this with PrimaryPart. If you want it to constantly spin you would have to loop it. I do not recommend using a BodyGyro to spin something because it would be inconsistent and would not have a linear spin, BodyGyros are generally used to lock a part’s rotation.

Here is an example snippet rotating a model using EulerAngles:

while wait() do
	model:SetPrimaryPartCFrame(part:GetPrimaryPartCFrame() * CFrame.fromEulerAnglesXYZ(.0, .03, .0))	
end

The issue is that I’m using BodyVelocity in order to move a projectile, but I need it to spin. That method could work, but the projectile would not move

you could use BodyAngularVelocity instead

local bodyAngularVelocity = Instance.new("BodyAngularVelocity")
bodyAngularVelocity.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bodyAngularVelocity.AngularVelocity = vector * rotSpeed -- vector times rotation speed, you could play with the rotation speed to fit something that you like
bodyAngularVelocity.Parent = parent -- parent path
1 Like

It worked! Sort of, well it works when I’m standing in a straight direction.

Straight Direction: https://gyazo.com/c0093f43936c15dc862ea10732aaf9a5

Other than Straight Direction: https://gyazo.com/bcf3baaff97fc8380dde152e2c716aa2

Do you know how to fix this? The script I’m using is:

local Rotate = Instance.new("BodyAngularVelocity")
Rotate.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
Rotate.AngularVelocity = Vector3.new(0, 0, 3) * math.rad(360)
1 Like

Ah well, I’m just trying to get it to rotate in a spinning motion, so unfortunately I can’t use mouse position

ok well just do

Vector3.new(1, 0, 0) --[[or whatever]] * 2

or like u wanted to rotate it before

Vector3.new(0, 0, 3) * 2 --2 could be anything, if it's too fast do like 0.5 or whatever, you control it!

(and forget the mousePos that was a mistake lol)

Ah well, that only works when facing forwards (like in the gyazo gifs). Do you know how to make it so that it works when facing all directions?

i don’t think that has anything to do with the angular velocity? angular velocity just makes something spin.

i think it has to do with your bodyvelocity and the way you positioned it.

i’m gonna need some more info…

This is the body velocity script

Move.Velocity = plr.Character.Humanoid.RootPart.HRP2.CFrame.LookVector * 70

what exactly is the issue? i’m very confused

Woops! I’ve been using the wrong gif. Give me a second sorry

Alright, so here’s the issue. When I’m facing a direction other than straight forwards, it does not work.

Facing straight forwards: https://gyazo.com/bd8126b72cf511a84da19da4cb7d3e54
Facing a direction other than straight: https://gyazo.com/a9c17265ebe1e85f3b08984d1bf0213d

uhh maybe set the angular velocity to the lookVector of the humanoid root part?

2 Likes

It worked, lol thanks mate! Much appreciated

1 Like