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

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

Asked by 7 years ago

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

Log in to vote
5
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago

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

script.Parent.CFrame.lookVector * -1
0
Awesome! thanks! Void_Frost 571 — 7y
0
trying to make an NPC that has 360 detection! (So he can walk to you and harm you) Void_Frost 571 — 7y
Ad

Answer this question