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

How can I get a CFrame relative to a position and rotation?

Asked by 7 years ago

I'm trying to consistently place my player exactly 1.65 studs above a brick, but my method doesn't incorporate rotation. It doesn't break, but I want it to seem like the player is sitting on the brick.

--rootPart is the HumanoidRootPart
--seat is the seat the player is sitting on
rootPart.CFrame=seat.CFrame+Vector3.new(0,1.65,0)

I'm really not sure how to approach this, any help would be appreciated!

1 answer

Log in to vote
1
Answered by
Link150 1355 Badge of Merit Moderation Voter
7 years ago
rootPart.CFrame = seat.CFrame * CFrame.new(0, 1.65, 0)

All you gotta remember is that you add vectors, but multiply CFrames.

1
Here's a good link to explain more about this by BlueTaslem. https://scriptinghelpers.org/questions/37400/a-short-cframe-question-can-someone-explain-this OldPalHappy 1477 — 7y
0
Thanks @OldPalHappy, I was looking for it. Link150 1355 — 7y
0
Thanks so much! I've been puzzling over this for years! ChipioIndustries 454 — 7y
Ad

Answer this question