Game Development Community

Offseting Position based off Rotation...

by Jeremiah Fulbright · in Torque Game Engine Advanced · 02/25/2007 (7:53 pm) · 0 replies

I have been trying to figure out this problem we're having for a little bit and I figured I'd just go ahead and ask here, as it might help others in the future.

Unfortunately, I'm not super math savvy (oddly), and thats probably what this will come down to, but between Matrixes, Eulers, Point3Fs, its not hard to get lost...

Okay, Basically, I worked in code to allow placing of Nodes for lights to be added at OnAdd time, for Interiors. So our level designer could work on an Interior, then drop nodes where he wanted lights possibly, then set the specific datablock.. then map2dif would handle it and dump that information into the dif..

In the OnAdd for the InteriorInstance, I go thru the Entity list and create sgLightObjects for the nodes, as needed. Obviously since they're attached to the Interior, they're easy to keep up with, but all I am doing right now is using the Interiors position to offset the position saved for the Nodes.

This works great unless the Interior is rotated, at which point the Nodes have no idea about the rotation and positions are still the same, and thus wrong.

I need to be able to offset the position of the Nodes by the Interiors Rotation. I did some experimenting with Eulers and AngAxisF and such, but couldn't get them to line up right..

Any help would be much appreciated!