Hi,
I couldn’t find any topics, or Videos related to it by searching, so I posted here.
So right now I’m currently Playing Around with ViewportFrames
, and I’m trying to match its LightDirection
with the way the Light is facing in the World, I have tried to use game.Lighting:GetSunDirection()
to help with getting that direction, but I dont really know if thats the actual way to do it, or if its even Possible.
But I dont want it to just face where its pointing, I trying to get it to rotate based on the Direction the Player’s Camera is facing, which is where I’m running into problems.
A Couple of things I have Tried was to try subtracting, and adding the Camera’s LookVector
with the Sun Direction, I also used Position
but every Result I got was it was off by a couple of Degree’s, or doesnt work at all (the lighting ends up glitching out)
I played around with the values a bit, and this is what I currently have, which I’m pretty sure I’m doing it completely wrong:
local SunDir = Lighting:GetSunDirection() -- Sun Direction
local CamDir = Camera.CFrame.LookVector -- Camera LookVector
local Dir = (camDir - SunDir) -- I'm pretty sure I'm missing something here
ViewportFrame.LightDirection = Direction -- Applies "Light Direction"
I feel like I’m missing something important, or missing something entirely, this is my first time trying to do it so I might be missing something.