# How to rotate a model by itself? [big hard math help needed]

So I got 3 vector3’s which describe the verticies positions and like I’ll do a rotational matrix transform on them but they just move in respect to the origin. How can I make it so instead of it rotating relative to origin rather to itself?
Here’s an illustration of what I want, note the triangles on the right are all in 1 place

Using CFrame.

Given variable `Part` is a Part,

``````local newCFrame = Part.CFrame:ToWorldSpace(CFrame.new(2, 0, 2)) -- this is the offset
-- yes, this offset is relative to Part
``````

Yea but heres the thing I dont have a cframe all I got is a guis position and I tell it what color it should be

If the main problem you’re having is that they only rotate in respect to the origin, then the solution must be to translate the center of rotation to the origin, rotate the object in the desired manner, then translate the object back to the original position. This is something I had to do in my class on OpenGL.

easy, just make a extremely small part, make it massless, cancollide false, and attatch it to the model, then set that as the primary part, and rotate using the primary part (you asked help from discord right?)

This is actually what they told me on a discord server but they were quite rude when i told them i had no idea how matrix transformations work, could you explain?

a week later, I solved it. The solution was to set the origin to itself like @landon90 suggested but instead of translating back rather calculate their COV then use that as the transformation about. This lady was very helpful

Also for anybody scavenging this on the internet years later here is a mathematical model I prepared in desmos

1 Like