Disable player control when in shadow?

Is this possible? … Disable player movement when in shadow but reenable player movement when out of shadow.

I have:
x1 light
x1 circle (sprite)
x1 player (sprite) with top-down movement behaviour.


What I would like to achieve is… player controls stop if player is in the shadow of the circle.
I’m looking through the light options.

is this possible?

Rob the Noob

You won’t find a solution in the light options. Your best bet is to use a raycast from the player to the light source.

First put all the objects that can case a shadow into an object group (say called ShadowObjects), and then raycast from player centre to the light source centre testing against ShadowObjects. Keep the behaviour disabled while the raycast returns an a ShadowObject.

This will work if more than half the player is out of the shadow.


Thanks @MrMen , Sorry about the wait. I will try this and get back to you.

Admin - Please close this one off. I will look at something more simple.

If you’re having trouble getting to grips with raycasting, just ask on the forum; that’s what it’s for. If you can provide a code snippet of what you’ve done, someone will be able to help.