Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Placing model where character dies but it's rotated by 90 degrees. How do I fix it?

I am not very good at CFrame.

This is how I have it now:

body:SetPrimaryPartCFrame (pos * CFrame.new(0, 0.15, 0))

How do I rotate it as well?

1 answer

make CFrame.new(position you want in Vector3)*CFrame.angles(0,0,0)

Use CFrame.angles to set rotation. Use math.pi or math.rad(number) on x,y,z values of the cframe.angles to make it easier.

6 comments

0

When I do this, it rotates it differently each time. Is there a way to have one set orientation rather than doing math each time? Does that make sense?

0

It shoulndt since CFrame.new() has default rotation matrix and * CFrame.Angles() applies the same rotation each time, can you share your changes that you made

0

Here is what I used: body:SetPrimaryPartCFrame ((pos * CFrame.new(0, 0.15, 0)) * CFrame.Angles(0,0,-90)). I went through everything. if I do CFrame.Angles(0,0,math.rad(90)), it breaks it and the object doesn't appear at all.

0

I realized something. I have it getting the position of the character's foot, and just slightly raising it (hence the .15). If the foot is rotated at all, it's probably taking that right? How do I just give it a final/static value so that my model is flat on the floor rather than rotated?

0

Im not sure what pos is but you should make a CFrame with the default rotation and apply rotation on that like this body:SetPrimaryPartCFrame(CFrame.new(positionChar + offsetVector) * CFrame.Angles(0,0,math.rad(90))) which exactly as the above poster commented

This discussion is preserved as it was. New answers, comments, and votes are closed.