Recently I've been doing more Saturn development, because the SGL is fun to use. I also want to see a tool for ripping models from NiGHTS complete with correct positioning on different objects.

Here's how the SGL (Saturn Graphics Library) does it. This may shed light on how we can get it from NiGHTS.

The position, rotation and scaling for every object is stored in a matrix which is pushed to the stack, changed through the transformation functions slRotX(), slRotY(), slRotZ(), slTranslate() and slScale() and popped again. This positions and draws one object on screen.

Now, objects can also inherit the matrix of their parent. They then apply their own transformations and are displayed in the usual way.

Here's how it works. In the following snippet pos1[XYZ] and pos2[XYZ] are FIXED values and ang1[XYZ] and ang2[XYZ] are ANGLE values. PD_PLANE1 and PD_PLANE2 are both polygons whose nature is irrelevant. (A real SGL application will have more content since it needs the C gubbins to actually make everything work, but this is the crux of it.)

Here the positioning of PD_PLANE2 inherits the matrix of PD_PLANE1 - in essence PD_PLANE2's position is calculated relative to that of PD_PLANE1. By incrementing ang2[Y] I could for example make PD_PLANE2 spin. It's important to note that if I increment ang1[Y] then PD_PLANE1 and PD_PLANE2 both spin - PD_PLANE2 keeps its position the same relative to PD_PLANE1.

Someone more intelligent, more attractive and more godlike will be able to talk about the assembly code this generates and we may from there be able to assess what sort of thing we should be looking for in order to calculate the relative positions for each object in a full model. We're quite close to being able to rip a model from NiGHTS with correct positioning, but more work is needed and I hope I can call on the CulT gremlins to work their usual magic.