3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Trouble rotating Sun Light objects?  (Read 1111 times)

« on: September 25, 2009, 11:00:11 PM »
This thread is in the Technical forum because according to documentation this should be working properly and could be a bug.

So I am trying to do a spinning sunlight object, simulating a bright moving light. This is accomplished via a script object. I added a vector skinmesh to make sure I am doing the math right and the skinmesh is pointing properly, however the sunlight object is pointing constantly downward.

Excerpt from my script, adding names of objects instead of their OBJ_ reference.
Code: [Select]
  iObjectLocation(OBJ_<Spotlight>, base_loc);
  iVectorEulerRotate(new_loc, base_loc, 0.0f, 1.0f, 0.0f,"xyz");
  iObjectLocationSet(OBJ_<Spotlight>, new_loc);
  iVectorLengthSet(new_loc, new_loc, 1.0f);
  iQuaternionLookAt(light_pitch, new_loc, Vector3(0,1,0));
  iObjectOrientationSet(OBJ_<Vector SkinMesh>, light_pitch);
  iObjectOrientationSet(OBJ_<SunLight Object>, light_pitch);

When I run this code (The real one of course), the vector skinmesh points in the proper direction, toward the spotlight object. However, the sunlight points from the top downward.

Anyone have any idea what I might be doing wrong?
Be who you are and say what you feel   -----------------------------------
------   For those who mind don't matter and those who matter don't mind....
« Reply #1 on: September 26, 2009, 12:46:11 AM »
I played around with your code, and you are quite right.....the sunlight object does not rotate as you would expect.

I also experimented with simply the following:

Quote
iQuaternionFromEulerAngles(Q,0,F,45,"xyz");
  F+=0.1;
  iObjectOrientationSet(OBJ_<Sunlight>, Q);
  iObjectOrientationSet(OBJ_<Skinmesh>, Q);

I found that you can rotate the Sunlight object around the X and Z axes, but not the Y axis.

In the Visual Editor, however, one can rotate the Sunlight object around all axes.
AKA: The 3D Raddict http://www.3draddict.com/
« Reply #2 on: September 26, 2009, 01:47:35 AM »
well, it works if you link a skinmesh to the sunlight and rotate the skinmesh instead the sunlight.
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #3 on: September 26, 2009, 02:39:14 AM »
OK....that's a good workaround, but not exactly intuitive.

In script, if you are able to orientate the Sunlight object (on its own) around the X and Z axes, you should also be able to orientate it around the Y axis :-\ ???
AKA: The 3D Raddict http://www.3draddict.com/
« Reply #4 on: September 26, 2009, 04:37:05 AM »
Yes this looks like a bug. Thanx for reporting it Slamoid! If possible a patch will be included to the October 2009 update.
Pages: [1]