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

[SOLVED] How do you make a part be orientated in relation to your torso?

Asked by
LawlR 182
5 years ago
Edited 5 years ago
local offset = Vector3.new(2, -(1.6 * head.Size.Y), -13)
newEffect.CFrame = head.CFrame * CFrame.new(offset)
newEffect.Orientation = Vector3.new(0, head.Orientation.Y - 90, 90)

I've done that, however it only works when the player is standing up. So if they've fallen over and are facing the sky, the part will not be orientated correctly.

I've tried fiddling around with look/up/rightVector but I couldn't get what I wanted with those.

Note: The X or Z values of the orientation have to be 90 or -90, otherwise the mesh inside of the part will be orientated wrong.

Pictures for slightly better understanding:

When standing up: https://gyazo.com/64eaa4f5a89a7c09a947cb78383539b8

When fallen down: https://gyazo.com/7338f795ea5120c1078e2dec1ab67e70

What I'm trying to accomplish: https://gyazo.com/7fc7d31556fbdd782c56083d3b942e11

EDIT: Solved it! Completely forgot about radians. Removed the orientation line and added onto the cframe line.

newEffect.CFrame = head.CFrame * CFrame.new(offset) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)

Answer this question