- Home /
How to detect whether or not my player is in the sun?
I want to make a game where the players body temperature will increase if they are in the sun and decrease if they are in shade. I have a procedural sun with a day night cycle, I have tried raycasting to the sun but it doesn't work because the ray just goes towards the directional light object not the sun in the sky. I have also tried rotating an object around the terrain at the same time as the sun but that only works when standing right in the middle of the terrain. Any help would be greatly appreciated :)
Vector3 raycastDir = -directionalLightTransform.forward;
Your answer
Follow this Question
Related Questions
Unable to apply "transform" on gameobject from Raycast 1 Answer
Unity 2D: Visualise a field of view cone 3 Answers
SInce when?!?!? (Raycast issue) 2 Answers
Problem With Raycasthit Angle 0 Answers
[C#] UNET Client raycast not the same as Server raycast 2 Answers