Light source

Does vc support light source addition to component?what can i do if i want add a blinking light source in a component.In some scenerio, it is quite useful.

Thanks a lot.

You can do that using the python API. The light sources can’t be attached to a component but you can modify the position of the light in a script in the OnSimulationUpdate event to keep the light ‘attached’ to a component.

This snippet shows the basics.

from vcScript import *
import vcVector

app = getApplication()
L = app.findLight('MyLight')
if not L:
  L = app.createLight('MyLight')
p =,1000,300)
L.Position = p


Then you can make it blink like this:

    L.Enabled = True
    L.Enabled = False


Thanks so much for your reply,but it seem do not work as you told.I did not see any light in VC 3D world,I have tried to scirpt both in componet and plugin form .Did you test it in your VC, I am not sure where went light here

You could try to increase the intensity of the light to see the effect more clearly.

For example:

L.Intensity = 1000.0

That value is quite large but you should see if it works.


Also notice that the location 1000,1000,1000 in the example script is world coordinates. You could use e.g. app.OnRender event to update the location of the light dynamically.

Also the light acts a little differently in the Shaded mode than in the RealisticShaded mode. I’ll try to add some example light components in the online ecat.

I got another question troubling me for some time, does VC have a mouse click event Python api when clicking a component or i have to use the netCommand to do it(which one), I would like to script it inside the component.Please enlighten me,thank you.

Please use more suitable thread. If you can’t find one, please create a new one.

This thread is for “Light Source”

hi there,any progress yet?I hear it is powered by unity 3d,can i use light function in unity, i am trying this way.

emeritus,could you share a lighting module, I want to attach the light to a component but don’t know how to do it