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
6 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)

part1.CFrame.Angles = part2.CFrame.Angles

Sorry if this is a stupid question.

heh... :P

        .--'''''''''--.
    .'      .---.      '.
   /    .-----------.    \
  /        .-----.        \
  |       .-.   .-.       |
  |      /   \ /   \      |
   \    | .-. | .-. |    /
    '-._| | | | | | |_.-'
        | '-' | '-' |
         \___/ \___/
      _.-'  /   \  `-._
    .' _.--|     |--._ '.
    ' _...-|     |-..._ '
           |     |
           '.___.'
             | |
            _| |_
           /\( )/\
          /  ` '  \
         | |     | |
         '-'     '-'
         | |     | |
         | |     | |
         | |-----| |
      .`/  |     | |/`.
      |    |     |    |
      '._.'| .-. |'._.'
            \ | /
            | | |
            | | |
            | | |
           /| | |\
         .'_| | |_`.
          `. | | | .'
      .    /  |  \    .
     /o`.-'  / \  `-.`o\
    /o  o\ .'   `. /o  o\
    `.___.'       `.___.'

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
6 years ago
Edited 6 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:

part1.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 — 6y
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 — 6y
0
btw sorry for the late reply, I had a WiFi problem. ax_gold 360 — 6y
Ad

Answer this question