Entity System - Light rotation

Previous topic - Next topic

matty47

Hi, I have been playing with the Entity System code but am having trouble with the light direction. The lights are drawn in the following code
Code (glbasic) Select
X_SPOT_LT iLight, o.color, o.Mg[12], o.Mg[13], o.Mg[14], _
o.Mg[12]+o.Mg[0], o.Mg[13]+o.Mg[1], o.Mg[14]+o.Mg[2], o.cutoff

and I know that the first three entries on the second line are supposed to give the vector of the light direction. Note that I have added a new field to the entity type (cutoff) with a couple of functions tha allow me to change the cutoff angle of the spotlight. My problem is that if I set the cutoff to say 45 to make a regular spotlight and then do an entity rotate in the main loop the light doesn't seem to rotate. I suspect this line as the camera uses the same code but with the camera you are specifying the point to which the camera is pointed whereas with the light I believe you are specifying a vector from the light (not a point). Before I go off writing separate light routines can anyone tell me the correct entries for the vector - or have I missed something again.
Thanks for any help
Matthew

Kitty Hello

The parameters int the 2nd line are the direction. Thus, you should write:
Code (glbasic) Select

X_SPOT_LT iLight, o.color, o.Mg[12], o.Mg[13], o.Mg[14], _
o.Mg[0], o.Mg[1], o.Mg[2], o.cutoff

to get it working. Thanks a lot for using this functions and extending them!  :good:

matty47

Thanks mighty quick answer. Sort of fixed it I need to play with it some more.
Matthew