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

How would i reverse a lookvector? (Look backwards from an object)

Explanation: lookvector is the forward part of a cframe. How would i look BACKWARDS from a Cframe? This is what i tried:

local ray = Ray.new(
                script.Parent.Position,
               script.Parent.CFrame.lookVector/200
            )

It didn't work.

1 answer

✓ Accepted answer

The lookVector is already facing forwards, use the - unary negation operator to reverse it.

script.Parent.CFrame.lookVector * -1

2 comments

0

Awesome! thanks!

0

trying to make an NPC that has 360 detection! (So he can walk to you and harm you)

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