It sounds weird-- but I'm trying to get a part to face my character, and this part has a cylinder mesh in it-- because the body gyro would only make the front face of a part face me, and because the mesh doesn't face the front--
local Gyro = Instance.new("BodyGyro", Part) Gyro.CFrame = CFrame.new(Part.Position, TorsoPos) Gyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) Gyro.P = 999999
I was wondering if there is a way get it to have the left or right face of a part face me instead, so it looks right because I cant come up with the math to rotate it properly myself. =w=;
AND UH IF YOUR ANSWER USES MATH could you please explain what it is you're doing in case I don't understand it?
You need to rotate the cframe with CFrame.Angles()
local Gyro = Instance.new("BodyGyro", Part) Gyro.CFrame = CFrame.new(Part.Position, TorsoPos) * CFrame.Angles(0, 0, math.rad(-90)) Gyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge) Gyro.P = 999999
the math.rad() will turn an angle in degrees, into one in radians, because CFrame.Angles accepts radians. Just fiddle with that, not sure which way it would need to be rotation, so try moving the math.rad() around between the 3 spots, and changing it between -90 or 90, you'll figure it out with a bit of experimentation
CFrame.Angles(math.rad(-90) , 0, 0) CFrame.Angles(math.rad(90), 0, 0) CFrame.Angles(0, math.rad(-90) ,0) CFrame.Angles(0, math.rad(90), 0) CFrame.Angles(0, 0, math.rad(-90)) CFrame.Angles(0, 0, math.rad(90))