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

Modifying or setting an object's CFrame's orientation?

Asked by
Jo_Bot 67
7 years ago

Is there a way I can set an object's CFrame's Angles?

Something like this, but .Angles is the part I am unsure about(CFrame.Angles isn't correct)

1part1.CFrame.Angles = part2.CFrame.Angles

Sorry if this is a stupid question.

heh... :P

01      .--'''''''''--.
02  .'      .---.      '.
03 /    .-----------.    \
04/        .-----.        \
05|       .-.   .-.       |
06|      /   \ /   \      |
07 \    | .-. | .-. |    /
08  '-._| | | | | | |_.-'
09      | '-' | '-' |
10       \___/ \___/
11    _.-'  /   \  `-._
12  .' _.--|     |--._ '.
13  ' _...-|     |-..._ '
14         |     |
15         '.___.'
View all 38 lines...

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
7 years ago
Edited 7 years ago

CFrame.Angles isn't part of a part's CFrame, but it's a part of the CFrame value itself. That sounds kinda complicated, so instead just keep the position and change the orientation, like so:

1part1.CFrame = CFrame.New(part1.CFrame.p, part2.CFrame.lookVector)
0
hmm, so what if I want to do Motor6Ds? I know lookVector is not a property of Transform, so how would I approach this? (part1 and part2 would be Motor6D1 and Motor6D2) Jo_Bot 67 — 7y
0
"part1.Motor6D.C0 = CFrame.New(part1.Motor6D.C0.p, part2.Motor6D.C0.lookVector)" That should work. However, if you want to point at the part rather than copy it's orientation, use a lowercase p instead of lookVector on the second part. ax_gold 360 — 7y
0
btw sorry for the late reply, I had a WiFi problem. ax_gold 360 — 7y
Ad

Answer this question