Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

3 comments

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)

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.

0

btw sorry for the late reply, I had a WiFi problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.