Using a mesh as Parent to Spotlight

Blitz3D Forums/Blitz3D Programming/Using a mesh as Parent to Spotlight

Imperium(Posted 2013) [#1]




I'm trying to use 4 different meshes to help position a series of spot lights but its not working correctly. The lights won't position themselves at the parent objects location. The image above is the map inside maya showing the cubes as markers for the spot lights.




Kryzon(Posted 2013) [#2]
From the documentation:

Specifying a parent entity will still result in the light being created at position 0,0,0 rather than at the parent entity's position.


Rather do the following:
greenLight2 = CreateLight( 3 )
EntityParent( greenLight2, dummyLight2, False ) ;The False parameter forces an 'alignment' of the child with the parent.



Imperium(Posted 2013) [#3]
It won't face the floor and I've tried changing both YAW and PITCH. The light still doesn't seem to be attached to the parent either. It's only supposed to be a small green light on the ceiling.

I've set the light range to 8. Should I just make another object to point it to the floor? Something tells me this is not the best approach. I also think you can't Rotate a light but instead turn it.


Kryzon(Posted 2013) [#4]
I would first make a mesh to represent the light. A cone primitive, for instance. This way I would have something visible to tune and see if it's positioned correctly etc.

Then after testing, I would replace the cone entity with the actual light.


Imperium(Posted 2013) [#5]
I've already tried that with createsphere with a light attached. This redlight I tested earlier happily followed around the sphere when I moved it in real time. I'm taking a close look at it now.

edit:


This is driving me crazy. In the original post I took out the Turnentity for the dummylights because I thought that may be affecting the positioning of the actual light.


Kryzon(Posted 2013) [#6]
There's not much way to help without having the entire scene and code here.
In any case, a particular problem I had when dealing with Blitz3D and 3DS Max (I think Maya may be the same) was the axis convention: in 3DS the Z and Y axes are swapped.


RemiD(Posted 2013) [#7]
I have not managed to find the right calculation to scale the "rayon" according to the lightcone angles.

But this will give you an idea on how to set an entity as a child of another entity, and give the child entity the same orientation and position :