0
Under review

Increase/decrease light depending on proximity to light

dpainmusic 7 months ago in Game Creator updated by Marti (Lead Developer) 3 months ago 8

I'm currently working on a project for class. I have characters with spotlights directly on them to indicate when you are hearing their "thoughts." I'd like to change the intensity of the spot light depending on your proximity to the character (light off when you're nowhere near them, light full intensity when you are beside them and hearing their thoughts).

Any suggestions of how to accomplish this are greatly appreciated!

Unity version:
2019.2.12f1
Game Creator version:

Answer

Answer
Completed

Hi DPainMusic! Sorry for the late reply. This is a very cool idea!

This is one of those cases where a custom Action would be best. Despite having little time, I couldn't resist making and testing this Action :-P Works really nice!

action-thoughts.unitypackage


I'm attaching the Action. Simply add it to your project and add an "On Start" Trigger per each light. Then, add two Actions:

- Light Thoughts: Drag and drop the light and set the max distance (to which the light will have an intensity of zero) and max intensity.

- Restart Actions: To loop this Actions over and over again.


That should be all! Let me know if you have any questions. Cheers!

Answer
Completed

Hi DPainMusic! Sorry for the late reply. This is a very cool idea!

This is one of those cases where a custom Action would be best. Despite having little time, I couldn't resist making and testing this Action :-P Works really nice!

action-thoughts.unitypackage


I'm attaching the Action. Simply add it to your project and add an "On Start" Trigger per each light. Then, add two Actions:

- Light Thoughts: Drag and drop the light and set the max distance (to which the light will have an intensity of zero) and max intensity.

- Restart Actions: To loop this Actions over and over again.


That should be all! Let me know if you have any questions. Cheers!

+1

Oh wow! This is great! Thank you so much. I'm looking forward to getting this implemented in :D 

You're welcome! :-) Please let us know how it goes and share the result :-) I'm genuinely interested in how it looks like!

Hey Marti! I know this has been a while, but I recently opened the project back up to implement this asset. I'm re-working the project to add to a portfolio. Unfortunately, I could not get the asset you made for me to work. I'm sure this is my fault though since this is my first year of working in Unity and learning it :)

 I attached a screenshot of how I'm trying to implement what you made for me. Is this correct? Thanks!!!

Hi DPainMusic;

You almost have it. Instead of adding this Trigger and Actions on the Light component, add them onto your Player, and keep the values as they are in the screenshot. That should do it :-)

Cheers!

OH that makes so much sense. Thank you! I'll try that out in a bit. Thanks for your help Marti!

Hey Marti,

Unfortunately, this still isn't working after removing the Trigger and Actions from the individual spotlight and then using them on my First Person Controller. I have tried removing the intensity from the spotlight itself (from 65 to 0) to see if having it default to on is a problem. Do I need to have Auto-Generate Lighting enabled for this to work? I've attached a screenshot of the First Person Controller setup with the Actions and Thoughts. Thanks for your help!

Under review

Hi!

Ah I see the problem. You're not using Game Creator's character system. It's highly recommended you use it. Still, if you prefer to use this controller of yours, attach the HookPlayer component onto this.


Let me know if this solves the issue!