www.jpct.net

jPCT-AE - a 3d engine for Android => Bugs => Topic started by: Thomas. on January 23, 2013, 08:07:38 pm

Title: Parent and rotate/translate mesh
Post by: Thomas. on January 23, 2013, 08:07:38 pm
When I call translateMesh() or rotateMesh(), transformations from parent is not taken into account.
Title: Re: Parent and rotate/translate mesh
Post by: EgonOlsen on January 23, 2013, 09:04:12 pm
No, they aren't. But that's not a bug, it's by design. The docs state "Rotates the raw mesh data using the rotation matrix specified for this object.". I might be possible to work around this by setting the matrix from getWorldTransformation() as a temporarily rotation/translation matrix and execute the methods with those.
Title: Re: Parent and rotate/translate mesh
Post by: Thomas. on January 23, 2013, 09:31:10 pm
Matrix from getWorldTransformation() includes transformation from parent?
Title: Re: Parent and rotate/translate mesh
Post by: EgonOlsen on January 23, 2013, 09:39:56 pm
Yes, it does.
Title: Re: Parent and rotate/translate mesh
Post by: Thomas. on January 23, 2013, 10:04:11 pm
OK, thanks. My question does not relate to the actual problem, but why is not automatically called disable lazy transformations before transformation and enabled after? Is there any situation when do this is disadvantageously?
Title: Re: Parent and rotate/translate mesh
Post by: EgonOlsen on January 23, 2013, 10:11:32 pm
I thought about doing this in the past and i decided against it. Problem is, that i can't remember the reason, but i'm pretty sure that there was one... ;) However, you can simulate this behaviour by extending Object3D and do something like

Code: [Select]
@Override
public void translate(...) {
    super.translate(...);
    touch();
}