Hello.
If you have ever played Silhoutte you would know that the whole game is about staying in the shadow because the sun is deadly.
I want to replicate this kind of mechanic, although I am unsure of how I will be able to do that.
I’m not asking for a script or anything (unless u want to lol), just want to know how to do this mechanic.
Scottifly
(Scottifly)
February 8, 2023, 8:29pm
#2
I’m just guessing (and I could be completely wrong), but it may be done with raycasting.
Pure_Bacn
(Pure_Bacn)
February 8, 2023, 8:31pm
#3
Theoretically, every heartbeat, you can raycast from the position of the sun toward the player. Then, if the raycast doesn’t hit the player, then it means they are in a shadow. (You can do this for every part in the players body for more accuracy ig)
3 Likes
But how would you detect a shadow? I’m not an expert on Raycasting but I’m pretty sure you can’t do that.
I will try this. Hopefully it will work, also how would I Raycast from the sun?
You can try using this:
local SunDirection = game.Lighting:GetSunDirection() --> Returns a Vector3 direction of where the sun is pointing from 0,0,0
Someone created a module that ‘shadow casts’ that I think could also be helpful.
What is it?
Shadow Check Module provides a simple way to check how much of a given model is in the shadows of another model. It also allows you to specify whether you want to consider Sun or the Moon as the source of light.
How to use it?
The module exposes a simple check function.
.check(shadowCastModel, shadowCheckModel, celestialBody)
There are three main arguments. The first two arguments can either be a table of Instances or just an Instance itself. The first argument defines the model w…
2 Likes
system
(system)
Closed
February 22, 2023, 8:38pm
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.