Can't figure out how to rotate an object around world space Y-axis instead of object space Y-axis [SOLVED]

SOLVED

Hello!

I am currently making a small personal game project which involves collecting food items. I am trying to make it so that the items rotate around on the world space Y-Axis instead of their object space. I have a diagram below to try and elaborate.

Here, I am trying to rotate my part around the black axis (World Space). However, I am unable to figure out a way to do this and most of my solutions result in rotation around the yellow axis (Object Space) or completely broken rotation altogether. My method of rotating the part involves connecting a function to the Heartbeat event that is meant to alter the part’s Y-Axis rotation in World Space by 1 degree every frame. Here is my code at the moment:

self._Maid.rotationConnection = game:GetService("RunService").Heartbeat:Connect(function()
	self.model.CFrame = self.model.CFrame:ToWorldSpace(CFrame.Angles(0, math.rad(1), 0))
end)

This is my latest iteration of trying to solve this problem and it results in rotation around object space aka the yellow axis in the above diagram.

Any and all solutions would be appreciated but preferably ones that preserve my current method of updating the CFrame every frame instead of using - for example - Tween Service.

Update:
Solved the problem:

local RotCF = CFrame.Angles(0, math.rad(1) ,0):ToObjectSpace(self.model.CFrame)
self.model.CFrame = CFrame.fromMatrix(self.model.CFrame.Position,RotCF.XVector,RotCF.YVector,RotCF.ZVector)
2 Likes

If you have blender, you can angle the Chicken in Blender and then use it in a mesh it and it will look like that with an orientation of 0,0,0. This would will change the Y axis to the black line

https://gyazo.com/ea17b267a9e221333dd2254ec83a665c

I took a video.

Make sure the baseplate is deleted and the origin position is set to 0,0,0 so it doesn’t take the baseplate into blender and it centers. Also you’ll have to Anchor it

https://gyazo.com/2ea0c067743a0c315bb09266efe76a00

First remove the original rotation, then rotate the desired Angle and finally rotate back to the original rotation.

local pos = CFrame.new(self.model.Position)
self._Maid.rotationConnection = game:GetService("RunService").Heartbeat:Connect(function()
	self.model.CFrame = pos*CFrame.Angles(0, math.rad(1), 0)*(self.model.CFrame - self.model.Position)
end)