# Thread: A rotate pivot question

1. ## A rotate pivot question

Hello, I have a question about rotate pivots and Collada. It's actually driving me crazy. I have a cube, hovering at about 1 meter from the ground and I want to rotate it. But when I set the rotation animation, the cube rotates from the origin of the world! What really gets to me is that it doesn't seem to follow at all the pivot information (which correctly points to the center of the cube)!

(The cube's vertices are defined in world space.)

Here's the code. And I also tried to get rid of the "rotatePivotInverse", but no dice. I'm sure I must be doing something very stupid. Please, help!

Code :
```        <node type="NODE" id="pCube" name="pCube">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">0 1.02862 0</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<translate sid="rotatePivotInverse">0 -1.02862 0</translate>
<translate sid="scalePivot">0 1.02862 0</translate>
<translate sid="scalePivotInverse">0 -1.02862 0</translate>
<instance_geometry url="#pCubeShape">
(blah-blah...)
</node>
</node>```

2. ## Re: A rotate pivot question

Originally Posted by seith
I have a cube, hovering at about 1 meter from the ground and I want to rotate it. But when I set the rotation animation, the cube rotates from the origin of the world!
It's rotating about the origin of the <node>. Each COLLADA <node> is a local coordinate system (object space). A <rotate> is a rotation about a local axis.
Originally Posted by seith
What really gets to me is that it doesn't seem to follow at all the pivot information (which correctly points to the center of the cube)!
The example you posted looks okay from a COLLADA standpoint. What software are you using?
Originally Posted by seith
(The cube's vertices are defined in world space.)
Actually they are in object space and that just happens to be identical to world space in your example.

3. ## Re: A rotate pivot question

Thank you Marcus for your reply. It did light up a few bulbs, but I still cannot understand what the problem is. To answer your questions: I'm using Maya 2009 and the NextGen Collada exporter.

Here is a sample of the part describing the transforms (in the "visual_scene"). The file is made of 4 cylinders stacked on top of each-other and which are supposed, once animated, to curl up like a finger.

Each cylinder mesh is put inside a group, which is itself parented to the previous group and so on and so forth, in order to create a hierarchy like the one that would be needed to create a curling finger. The rotate animation is applied to the groups, not to the cylinders themselves, which again are located inside the groups.

The problem is still that each rotation happens from the origin of the very top node (not even the parent group's origin!), in this case the origin of the world. In Maya, the pivot point of the cylinders and their parent group match, and are each located at the base of the respective cylinders. I do not understand this behavior. How can I make sure the groups rotate from their own pivot point?

Code :
```      <node type="NODE" id="topNode" name="topNode">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">0 0 -0.00417177</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<translate sid="rotatePivotInverse">0 0 0.00417177</translate>
<translate sid="scalePivot">0 0 -0.00417177</translate>
<translate sid="scalePivotInverse">0 0 0.00417177</translate>
<node type="NODE" id="group1GRP" name="group1GRP">
<translate sid="translate">0 0 0</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<node type="NODE" id="pCylinder1" name="pCylinder1">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">0 0.00182104 0</translate>
<translate sid="rotatePivotInverse">0 -0.00182104 0</translate>
<translate sid="scalePivot">0 0.00182104 0</translate>
<translate sid="scalePivotInverse">0 -0.00182104 0</translate>
<instance_geometry url="#pCylinderShape1">
<bind_material>
<technique_common>
<instance_material symbol="lambert1" target="#lambert1"></instance_material>
</technique_common>
</bind_material>
</instance_geometry>
<node type="NODE" id="group2GRP" name="group2GRP">
<translate sid="translate">-0.404874 0.167552 0</translate>
<translate sid="rotatePivotTranslation">0.404874 -0.167552 0</translate>
<translate sid="rotatePivot">0 0.572948 0</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<translate sid="rotatePivotInverse">0 -0.572948 0</translate>
<translate sid="scalePivotTranslation">0 0 0</translate>
<translate sid="scalePivot">0 0.572948 0</translate>
<translate sid="scalePivotInverse">0 -0.572948 0</translate>
<node type="NODE" id="pCylinder2" name="pCylinder2">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">-0.000376239 0.572948 -0.00417177</translate>
<translate sid="rotatePivotInverse">0.000376239 -0.572948 0.00417177</translate>
<translate sid="scalePivot">-0.000376239 0.572948 -0.00417177</translate>
<translate sid="scalePivotInverse">0.000376239 -0.572948 0.00417177</translate>
<instance_geometry url="#pCylinderShape2">
<bind_material>
<technique_common>
<instance_material symbol="lambert1" target="#lambert1"></instance_material>
</technique_common>
</bind_material>
</instance_geometry>
<node type="NODE" id="group3GRP" name="group3GRP">
<translate sid="translate">-0.724743 0.30169 0</translate>
<translate sid="rotatePivotTranslation">0.726874 -0.300807 0</translate>
<translate sid="rotatePivot">0 1.02862 0</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<translate sid="rotatePivotInverse">0 -1.02862 0</translate>
<translate sid="scalePivot">0 1.02862 0</translate>
<translate sid="scalePivotInverse">0 -1.02862 0</translate>
<node type="NODE" id="pCylinder3" name="pCylinder3">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">-0.000376239 1.02862 -0.00417177</translate>
<translate sid="rotatePivotInverse">0.000376239 -1.02862 0.00417177</translate>
<translate sid="scalePivot">-0.000376239 1.02862 -0.00417177</translate>
<translate sid="scalePivotInverse">0.000376239 -1.02862 0.00417177</translate>
<instance_geometry url="#pCylinderShape3">
<bind_material>
<technique_common>
<instance_material symbol="lambert1" target="#lambert1"></instance_material>
</technique_common>
</bind_material>
</instance_geometry>
<node type="NODE" id="group4GRP" name="group4GRP">
<translate sid="translate">-0.934436 0.386567 0</translate>
<translate sid="rotatePivotTranslation">0.934271 -0.386636 0</translate>
<translate sid="rotatePivot">0 1.32211 0</translate>
<rotate sid="rotateZ">0 0 1 0</rotate>
<rotate sid="rotateY">0 1 0 0</rotate>
<rotate sid="rotateX">1 0 0 0</rotate>
<translate sid="rotatePivotInverse">0 -1.32211 0</translate>
<translate sid="scalePivot">0 1.32211 0</translate>
<translate sid="scalePivotInverse">0 -1.32211 0</translate>
<node type="NODE" id="pCylinder4" name="pCylinder4">
<translate sid="translate">0 0 0</translate>
<translate sid="rotatePivot">-0.000376239 1.32093 -0.00417177</translate>
<translate sid="rotatePivotInverse">0.000376239 -1.32093 0.00417177</translate>
<translate sid="scalePivot">-0.000376239 1.32093 -0.00417177</translate>
<translate sid="scalePivotInverse">0.000376239 -1.32093 0.00417177</translate>
<instance_geometry url="#pCylinderShape4">```

4. ## Re: A rotate pivot question

Originally Posted by seith
You're welcome.
Originally Posted by seith
The problem is still that each rotation happens from the origin of the very top node (not even the parent group's origin!), in this case the origin of the world.
Excuse me for asking again, ... but the rotation "happens" in what application? That is the application/importer where I suspect the problem resides.

The other suspect area is the animation data itself. If the <animation><channel> is replacing values with world space coordinates then that would also explain the problem. Or the application is doing something similar to this internally despite what the data says.

5. ## Re: A rotate pivot question

Oh, I'm working on a "filter" for Collada files exported from Maya into Sandbox2 (the editor for the game "Crysis"). The .dae files are compiled by the game's resource compiler and produce assets that are recognized by the game.

And I think you're probably right; it seems the resource compiler for Sandbox2 is very finicky about the names it expects. At least, after reading the Collada 1.5 specs I understand better the structure of the .dae files...

6. ## An answer in Maya

It might be too late but here's my answer to your problem :
The problem is in Maya, not in the Collada exporter. And the problem is simple : if you intend to export a Maya model with Collada, you should never use 'Freeze transformations' in Maya. If you do so, it will change the whole object space coordinate system.

More, if you already have used 'Freeze transformations', you can try and create null group, position it right where your object (or sub-object) is and parent your object to this null group, then all you'll have to do is to use this null group instead of your object in the application where you import your .DAE file (I've tested it successfully in Flash with PV3D).

Hope it still helps.

CYD (from Paris)

7. ## Re: A rotate pivot question

It's never too late to reply! Anyway, thanks for those explanations, Cyd. They do help.

Seith (also from Paris)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•