Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
Dfzoz 489 Moderation Voter
4 years ago

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.

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? JigglyWiggles 15 — 4y
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 VerdommeMan 1479 — 4y
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. JigglyWiggles 15 — 4y
View all comments (2 more)
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? JigglyWiggles 15 — 4y
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 VerdommeMan 1479 — 4y
Ad

Answer this question