Light and Shadows

Is there a way to create a light source that shines on objects when they are in proximity in Java Script? For example a flashlight or a lamp.

1 Like

I have the same question! : O

There is no build-in spotlight system in CoSpaces at the moment.
If you want to create light source by yourself, you could do the following:

  • attach the cone object to flashlight,
  • set cone opacity to 0.1
  • highlight objects when they collide with the cone.

Hope that helps

1 Like

That is a pretty genius solution Nikolay!

hi im trying to make a flashlight type thing and I saw this and I understand the basic concept but now how to actually apply that concept to code
like how would i make objects highlight when touched by the cone

Yes, How do I highlight objects when it collides with the cone?

Currently, the only way you can do “highlighting” is by changing to a brighter color. There is a Javascript property called BaseItem.highlight in the Developer API which hasn’t made it into the Public API yet, which could be used to make Light Sources (and is possibly what Nikolay was thinking of). I submitted a feature request for this a while ago. @Stefan

Geoff @ TechLeap

1 Like