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?
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?
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
6 comments
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?
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
https://gyazo.com/661d1dc5e4316406edb6e89ee5d3789e
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.
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?
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