I have a Part that is placed over an imaginary Sphere’s surface. Not really the Spherical coordinates system though. Anyway, my issue goes:
Given I have this data:
-
center: Vector3
, the center point of a sphere, -
rotation: CFrame
, the rotation matrix relative to the angle 0, -
radius: number
, needn’t explain,
I can calculate the position of the Part (surface point) using the formula
part.CFrame = CFrame.new(center) * rotation * CFrame.new(Vector3.new(0, radius, 0))
Okay, this works. Now the problem.
Knowing the rotation matrix, radius and the part’s position, I want to calculate the actual center
point of the sphere. I’ve tried this:
CFrame.new(Part.Position) * CFrame.Angles(rotation):Inverse() * CFrame.new(Vector3.new(0, -radius, 0)))
-- rotation is simply the actual rotation, since i dont need to invert the whole cframe
This works, partially. So what happens is, in literally every case, the X axis is substracted by 10.383215, and the Z axis is added by that exact number. For example, I would expect a center of (0 32 0)
but got (-10.383215, 32, 10.383215)
instead. Any idea?