Hello fellow Developers!
I’ve been working on a first person game recently and noticed there was a distinct lack of character shadows!
After a bit of experimentation I found a way of casting such shadows, although it does take a hit to performance, so please, feel free to experiment with this or improve it!
You can get it here!
LocalFirstPersonShadows - Roblox
Requirements:
- Place the script in StarterCharacterScripts
- Place a light in a part/attachment in workspace with Shadows enabled
How it works;
- Define all local (point, spot, surface, etc) light sources in the world (will account for lights in attachments)
- Create a stripped down clone of your character
- Scan through lights
- If within range, and not looking at - create a clone (doesn’t account for light Radius!)
- Scale clone and position in front of light source
- Delete clone for said light source if 4. isn’t met.
Limitations
- Performance is not great - use for experimental / showcase work!
- Sometimes the limbs of the shadow appear disconnected
- Doesn’t cast sun shadows! (You can use @Maximum_ADHD’s First Person Shadows for this)
Static Lights
Non-Static Lights