panda .find() problem cause collision confusion

i have this problem with find(’*object’) in egg model

after awhile tracing i already found this matter:
the previous egg file stated this:

 <Group> object1 {
    <Transform> {
      <Matrix4> {
        1 0 0 0
        0 1 0 0
        0 0 1 0
        0.936316 -0.404287 3.07116e-006 1
      }
    }
    <VertexPool> object1Shape.verts {
      <Vertex> 0 {
        -17.5596 0.293123 -71.1656
        <Normal> { -0.382027 -0.881503 -0.277502 }
        <RGBA> { 1 0 0 0.7686 }
      }

the new egg file, but still the same model stated:

  <Group> object1 {
    <VertexPool> object1Shape.verts {
      <Vertex> 0 {
        -17.5596 0.293123 -71.1656
        <Normal> { -0.382027 -0.881503 -0.277502 }
        <RGBA> { 1 0 0 0.7686 }
      }

note that the new one has no transform tag, i don’t know since it is exported by the maya2egg program, so i just entrust everything to it.

But the new one can’t be attached by a collision node just because it losts the transform tag.
No error occured on the collision, but no collision object appear on the screen nor the event.

Can somebody help me to explain this?

ok i guess here’s my own explanation …

i accidentally alter the hierarchy in my 3D software, don’t know what and which.

but the result that the collision was created though, but in different position.

the transformation hierarchy get messy somehow.

so the first egg have collision node set to its position itself.

but the last generated egg file cause the collision node cast away to 0,0,0 which is not the object position anymore.

any workaround to make them stable?

Try using a Locator object instead of 1 vtx mesh.
A Locator has DCS flag, which keeps the transform.

oh hi, thx for reply :slight_smile:

is there any other way other than using a locator?
since adding the locator means doubling the pinpointing job.

i don’t know why all the transform disappearing in the last export.

Previously, was the Maya transform gizmo located exactly at that vtx if the object is selected ? And is it now at 0,0,0 ?

Maybe you simply forgot the option to preserve transform in the last export ? How did you export it exactly ?

Using your current .egg, since it’s only 1 vtx object, to obtain that vtx coordinates, you could do :

np.getBounds().getCenter()

instead of getPos().

well i don’t know what possibly happened back then so it lose the transform attributes.

Might be because i’m cleaning the object history.

i try that getCenter(), but not the right position it should be.

So i just end up with the locator though. That’s the best we can get.

try this:

object1=geom_map.find('**/object1')
collision_node=object1.attachNewNode(collision_sphere)
collision_node.setPos(obj.find('**/object1_locator').getPos())

wish there’s some shorter way, but whatever works will do :wink:

Are you sure you had saved ALL transform during export ?
maya2egg -h :

-trans type  Specifies which transforms in the Maya file should be
             converted to transforms in the egg file.  The option may
             be one of all, model, dcs, or none.  The default is
             model, which means only transforms on nodes that have the
             model flag or the dcs flag are preserved.

Check the .egg’s line.

In case it’s really lost since in Maya, you could restore it by Modify > Center Pivot.

About the locator, why not :

object1 = geom_map.find('**/object1')
collision_node=object1.find('**/object1_locator').attachNewNode(collision_sphere)

oh yes, didn’t notice there is transform type in the export though.

yup it’s possible to attach to the locator, but it’s better to group it to the object, so i can control it based from the object.

so i don’t do double operation both on the object and the locator.

thanks.

ok in case somebody find this same problem …

as ynjh_jo said, the transform can be safely exported to preserve the object position by using this parameter:

maya2egg2009 -trans all c:/model.mb model.egg

hope this help to clear the confusion.

To ease your pain :
[The new maya2egg wrapper)