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

How do I rotate an object using BodyAngularVelocity according to local space?

Asked by
Rheines 661 Moderation Voter
5 years ago
Edited 5 years ago

I'm trying to rotate an object using BodyAngularVelocity but whatever I tried it always rotates the object according to global space.

https://gyazo.com/148dd94c0f16054a23ef417af8bb367b

local Crescent = AccDisksPRJ:Clone()
local PassedCF = CFrame.new(RootPart.CFrame.p, Mouse.Hit.p)
Crescent.CFrame = PassedCF * GBLSettings.SpawnOffset * CFrame.Angles(0,0,Rotation)

local Velocity = Instance.new("BodyVelocity")
local PassedVL = (Mouse.Hit.p-RootPart.Position).unit
Velocity.Velocity = PassedVL * 5
Velocity.MaxForce = Vector3.new(1,1,1) * math.huge
Velocity.P = 10000
Velocity.Parent = Crescent

local AgVelocy = Instance.new("BodyAngularVelocity")
AgVelocy.AngularVelocity = Vector3.new(0,-15,0)
AgVelocy.MaxTorque = Vector3.new(1,1,1) * math.huge
AgVelocy.P = 10000
AgVelocy.Parent = Crescent
Crescent.Parent = workspace

What I want to achieve is to have the objects rotate along its own axis. I know I'd have to use one of the CFrame methods such as :vectorToWorldSpace but I do not know how to use it in my case.

0
well, rotating along an object's own axis is object space, not world space theking48989987 2147 — 5y
0
Also, it isn't recommended to use BodyAngularVelocity if you want a constant rotation, it is recommended that you use a bodyGyro for that theking48989987 2147 — 5y
0
No, BodyGyro causes the part to only look at a certain direction. AngularVelocity causes it to rotate at a constant velocity. Rheines 661 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Don't know if this helps but I pulled this from the wiki

Tip: Regarding the AngularVelocity property, you can multiply a Vector3 by math.rad(360), or 2?, in order to convert angular frequency (rotations per second) into the desired angular velocity (radians per second). For example: Setting AngularVelocity to Vector3.new(0, 1, 0) * math.rad(360) ? Vector3.new(0, 6.283, 0) will cause a part to spin around the Y axis once per second.

https://developer.roblox.com/api-reference/class/BodyAngularVelocity

0
This is rotates the projectile according to global space, this is exactly what I did but in a different format. Vector3.new(0,15,0) == Vector3.new(0,1,0) * 15. Rheines 661 — 5y
0
damnn idkk then The_Pr0fessor 595 — 5y
Ad

Answer this question