node transforms

can anybody tell me how to get the transform of a node? i know this sounds simple, but all i see in some of the nodes is info for (and some of this data is missing for certain nodes, mostly translational data):
getRotate_array
getTranslate_array

getMatrix_array doesn’t have an data for all of my nodes.

You can use the domNode::getContents method to iterate over the elements in the <node> and concatenate all the transforms. The getContents method returns the elements in the order they appeared in the file, which is important for applying the transforms in the right order.

daeElementRefArray& elements = node->getContents();
Matrix resultMatrix = identity;

for (size_t i = 0; i < elements.getCount(); i++) {
  if (elements[i]->getElementType() == COLLADA_TYPE::TRANSLATE) {
    // We have a <translate> element. Convert it to a matrix and concatenate it with the result transform
    resultMatrix = convertToMatrix(elements[i])*resultMatrix;
  } else if (elements[i]->getElementType() == COLLADA_TYPE::ROTATE) {
    // Handle <rotate> element
  } else if ...

Also, you might want to check here or here for more info.

Thanks for the help.

I’m getting closer, but can’t seem to get the data from the “TRANSLATE” element.

In your code, where it says …
“// We have a <translate> element. Convert it to a matrix”

I’m translating this to mean:

domTranslate* domTrans = daeSafeCast<domTranslate>(elements[i]);
domFloat3 trans = domTrans->getValue ();

but trans contains invalid data.
Can you tell me what I’m doing wrong?

Not sure. This works for me:

void testTranslate() {
	DAE dae;
	char* docUri = "file:///home/sthomas/models/Seymour.dae";
	if (dae.load(docUri) != DAE_OK)
		return;

	// Get a random <translate> from the model
	daeElement* element = 0;
	dae.getDatabase()->getElement(&element, 0, 0, "translate");
	domTranslate* translate = daeSafeCast<domTranslate>(element);
	domFloat3& v = translate->getValue();
	cout << v[0] << ' ' << v[1] << ' ' << v[2] << endl;
}

It prints the value of the first <translate> element in the model, which in my case is 0 4.3 -1.0. This doesn’t work for you? In my code I’m getting the value by reference (domFloat3&) instead of copying it, but it should work the same either way (and does for me).