Using RotationInterpolator with already rotated Wavefront object

View: New views
2 Messages — Rating Filter:   Alert me  

Using RotationInterpolator with already rotated Wavefront object

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

currently I´m trying to rotate a Model I loaded from an .obj-File. The Model was facing the wrong side, so I did some rotations:

[code]
Transform3D yAxis = new Transform3D();
Matrix3d rotated = new Matrix3d();
yAxis.get(rotated);
rotated.rotX(-Math.toRadians(90.0d));
yAxis.set(rotated);
 
Transform3D mul = new Transform3D();
mul.rotZ(Math.toRadians(90.0d));
yAxis.mul(mul);
objTrans.setTransform(yAxis);
[/code]


objTrans is a TransformGroup containing my model. This is working as intented. Now I´m trying to constantly rotate this model using a RotationInterpolator:

[code]
Alpha rotationAlpha = new Alpha();
RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans);
rotator.setTransformAxis(yAxis);
objTrans.addChild(rotator);
rotator.setSchedulingBounds(new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0));
[/code]


The model is rotating, but it seems that the previous rotations I did got resetted and the model is facing the wrong direction again, as it did, when I loaded it.
I tried to do the rotations again before calling the RotationInterpolator, but it didn´t work. Suns documentation says:

[code]
One potential interpolator programming pitfall is not realizing that interpolator objects clobber the value
of its target objects. You might think that the TransformGroup target of a RotationInterpolator can be
used to translate the visual object in addition to the rotation provided by the interpolator. This is not true.
The transform set in the target TransformGroup object is re-written on each frame the Alpha object is
active. This also means that two interpolators can not have the same target object.
[/code]


This message was also posted to the SDN by accident. Does anyone have an idea? Any help on preserving the rotation is greaty appreciated!

Greetings,
Andy
[Message sent by forum member 'andy3d' (andy3d)]

http://forums.java.net/jive/thread.jspa?messageID=283604

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...


Re: Using RotationInterpolator with already rotated Wavefront object

by java3d-interest :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Answered in:

http://forum.java.sun.com/thread.jspa?threadID=5309938
[Message sent by forum member 'andy3d' (andy3d)]

http://forums.java.net/jive/thread.jspa?messageID=284144

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@...
For additional commands, e-mail: interest-help@...