jPCT-AE - a 3d engine for Android > Bugs

Child translation after remove parent relation

(1/2) > >>

Alexey:
If after parent object rotation remove child, child object reset translation/rotation which were applied by parent relation.
It is a bug? How i can leave child in current place after removing parent relation?

Alexey:
How does the process of rotation and translation works for child objects?
Can you tell, please, if i'm going to override child-parent relation, how better implement child rotation near parent pivot?

EgonOlsen:
It's not a bug. It's by design. It's not that easy to transfer the transformations of the complete parent-chain to the child. Maybe this thread helps: http://www.jpct.net/forum2/index.php/topic,2011.0.html. Another idea that comes to my mind, is to remove the actual parent, create a dummy object (that doesn't even belong to the world and is empty), set the parent's translation, rotation and rotation pivot to that dummy object and make it a parent of the child object.

Alexey:
Unfortunately solution from that thread not approached. In my case, for example -  5 objects

  (obj1)(---obj2---)(obj3)(---obj4---)(obj5)   on some axis

obj3 set parent to others & rotate, than remove all child relation, after that obj1 or another can be parent for same group of objects in another axis etc.
And dummy object solution i think not good for this situation, because possible many relation changes sequences.

For overriding relations i need move child's rotation pivot to parent rotation pivot, i tried use child.rotateAxis(parent.get*Axis(), angle) , but this some reason did not work, maybe need convert parent axis vector?

p.s. when in collision listener i try set texture to collision polygon (texture not set before) happens arrayIndexOutOfBounds, but polygon ID  < maxPolyIds.
p.p.s sorry for my english.

 

EgonOlsen:
Albeit i don't really get what you are after, my gut feeling tells me that you might be better of with doing the transformations yourself instead of relying on the parent/child-relations in this case. Shouldn't be that hard....if i got this correctly, all you have to do is to place the rotation pivot of any object other than obj3 to the distance of this object to obj3 and apply the rotations on each.

About setting the texture: Which version are you using? This used to happen when you tried to change a texture on a stripped object. Newer versions from the "new version"-thread should silently skip this operation in that case. Changing a texture on the fly doesn't really work anyway, because it would require a recompilation of the mesh, which isn't supported. This will work only if the polygon in question already used another texture than all the others, which is unlikely....or if the object hasn't been rendered at all, which isn't the case here. What is supported, is modification of texture coordinates on the fly, if the object is compiled with compile(true, false); and not stripped. With this, you can use one larger texture that consists of multiple smaller ones and switch them by changing the u/v-coordinates.

Navigation

[0] Message Index

[#] Next page

Go to full version