Skip to main content

Search

Is it possible for a character to take damage from light?

  • Mm Bogdan & Matt

    Hi, sadly we don't have a light detector gadget yet. For a spotlight you can do a pretty good approximation using a cone shaped trigger zone and a laser scope to check for occlusion. Place the laser scope at the light position and set it to "Point at Tags". Then stick a tag somewhere near the centre of your character. You'll want to setup the laser pointer's labels so that it will only register a hit with the player and also turn off X-ray mode so that objects in the way will block it.
    Set the trigger zone to look for the same target and apply damage when the laser scope and the trigger zone find their targets. As an optimisation you only need to power the laser scope when the trigger zone detects the player.
    Hope that helps
    Matt

  • benkeiuk

    Hi Matt, thanks for the reply.

    I'll see if I can follow this and give it a try later.
    Do you think a light detector gadget will make an appearance at some point? I can see it being pretty useful in a number of situations.

    Great work by the way! I'm only a week in but have already learned loads and got the basis of a game together which is way more than I expected.

    Cheers,
    Ben

  • Mm Bogdan & Matt

    It would be awesome but pretty expensive. Lighting calculations are only done for the little bit of the scene you are looking at for performance reasons. A light detector would need to work wherever in the scene an object was. Potentially it could just sum the light at a particular point which would reduce the cost slightly but still involve a raycast to each light that was in range.
    thanks
    Matt

Please sign in to leave a comment.