# Determining the Power needed to rotate a Part using BodyGyro?

Hello, what I want to achieve is to calculate the necessary property of a BodyGyro (In this case, the Power) to make a Part rotate X radians within Y time.

So, If I were to set the CFrame property of the BodyGyro to CFrame.Angles(0, math.pi/2, 0), I would want to calculate the “P” property necessary to make it turn within a certain time, regardless of the time value I feed it; it should rotate towards “math.pi/2” within that time frame every time.

I’ve fiddled with a couple equations derived from the Wikia, founded by the Power property in the API reference but I got a massive number returned which seemed unrealistic, even more when I tested the value.

I’m not sure if I need to constantly edit my MaxTorque, but I don’t plan on changing it (it’s a constant value in my case)
These are my BodyGyro properties:

MaxTorque : Vector3.new(8,8,8) * 1e4
D: 250 (another constant)
P : ? Unknown im trying to find to rotate a part X radians within a certain Time

Heres the function I tried to derive by mashing the ones I found in the Wikia page, I set the Power (P) property to the value below, and simply was not accurate.

Function I derived
``````local function calculatePower(theta, time, maxTorque)
local theta = theta or 0
local time = time or 1

local maxTorque = maxTorque or Vector3.new()
local r = 1

local t = maxTorque * r * math.sin(theta)
local w = theta / time

print(w)

return t * w
end

print(calculatePower(math.pi/2, 1, Vector3.new(80000, 80000, 80000)))
``````
1 Like

Basically I want to figure out the mathematical computation i need to set the value “P” to rotate the BodyGyro a certain amount of radians within a certain amount of time

1 Like