Rotation of a mesh

Hello, so I scripted an in-game store where you can buy pets using currency obtained from the game, however, I am experiencing an issue that I cannot figure out how to correct, even after doing proper research on this topic.

My issue is that when the pet is equipped, the rotation of the part remains on the incorrect side which I believe is due to the mesh being oriented the incorrect way. I am using meshes created by ROBLOX for this store.

I tried to rotate the part which the store clones and gives it to the player.character, which is located under replicated storage. I am very confused as to how to correct this issue and have attached an image for an example.

image

1 Like

How are you moving the pets? Welds/motors, CFrame, constraints, or body movers?

I’m not 100% sure I know how to answer that, but I believe I’m using Bodygyro and Bodyposition

				if pet ~= nil and hum ~= nil and head ~= nil then
					if hum.Health >= 0 then
						local cf = head.CFrame * CFrame.new(3,-2.5+fl,3)
						pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
						pet.BodyGyro.CFrame = head.CFrame * CFrame.new(3,0,-0)
					else
						break
					end
				end
			end

image

Correct, you are. What that means is that we have to rotate your body gyro using CFrame.Angles(). It’s gonna be a 90 degree rotation in one of the 3 axes depending on your mesh. It’ll look something like

pet.BodyGyro.CFrame = head.CFrame * CFrame.new(3, 0, 0) * CFrame.Angles(math.rad(90), 0, 0)

I can’t see the orientation of your mesh myself but I think this is correct. If it’s not, try rotating on the z axis instead.

3 Likes