Game Development Community

What does "nodeIndex" mean?

by Nabarro · in Torque Game Engine · 12/13/2007 (5:35 pm) · 2 replies

Hi, everybody,

I came across one problem with my player model which caused my program crashed, and I traced back and found below situation:

In tsShapeInstance.h (around 850 lines?Maybe not because I've changed much with my codes):

inline MatrixF * TSShapeInstance::ObjectInstance::getTransform()
{
return nodeIndex<0 ? NULL : smTransforms + nodeIndex;
}

For my player model, nodeIndex is always -1. Why? How to change the value and make it correct?

What does nodeIndex mean? Should I change my model and how to do that?

Anyone may help?

Thanks a lot,

#1
12/14/2007 (6:48 pm)
It sounds like your model is missing an important node. Which node is it trying to get the transform for?
#2
12/14/2007 (6:56 pm)
@Nabarro, in this case, nodeIndex is a number used to index into various things for a particular animation (or mount, or cam etc.) node. I think "smTransforms" in this case is a pointer to the node transforms, and the + nodeIndex increments the pointer to the particular transform of nodeIndex (so, if it's 0, it'd be the pointer itself, if it's 1 it'd be offset by sizeof( MatrixF ) so you'd get the transform for the second node). Since the indices are S32 values, -1 is considered an invalid index, which is why it's returning NULL for you. As Brian says, you're probably missing an important node.