local coordinate system for TransformGroup?

Hello,

I don’t want to use these Interpolators, because I don’t understand (like) the animation by an Alpha Object. But when I control my Transformations by a behaviour which is called every Frame I can’t set a local coordinate system for things like rotation. My Object always rotates around the origin of my Virtual Universe instead of the local Origin!!

I need something like

setTransformAxis();

, like in TransformInterpolator.

I don’t know how to integrate these Alpha object controlled Interpolators in my game design. If there are any proposals, you’re welcome ;)!

Game-Design:
MainClass | | GameUpdaterBehaviour Universe/View/Objectloader | | GameUpdater--->direct ---> TransformGroups updates (Transform3D) every Frame!!

Greets,

Juan

You need to becarefull how you modify your TransformGroup.

For Rotation and Translation, order might be the cause for your problem, but it really depends on how you have things setup.

For instance, if you have a TransformGroup called rotateTG and another called translateTG then depending on which one is a child of another will give you a differnent effect.

If you have it setup like this, then it should work

View
|
translateTG
|
rotateTG

Hi
I don’t know why everyone insists on using two transform groups for this. As long as you .mul them in the right order, one will do.

Cheers

Endolf

It might be more efficient if you’re intending to do alot of updates.

Kev

Hi there,

thank you for answering! The local rotation works now! I’ve done it in this order:

View | translate | rotate

The problem with the local rotation is solved by another solution. I set the position in every Frame from the origin to the new position. I transformed this vector with my rotation. So it must rotate around the origin. Now I set the position in the beginning, then calculate the movement and add it to the old position. Only the vector from the current (old) position to the new position is transformed by the rotation.

This works!!!

To endolf:

multiplying the Transforms has the ugly sideeffect, that when multyplying translation with rotation the ship rotation flickers, the other way around the translation flickers. I don’t know why, but using two transformgroups with seperated Transforms solves this problem. So I have a translation TG with a rotation TG as child and the Ship BG as a child of rotation TG!

This works!

But like always, I have a new problem!!! The View doesn’t follow the Ship proberly.

What the view should do:

  1. When my ship rotates, the View has to rotate around the ship so that it is always a littlebit behind (130m) and higher (50m) as the ship.
  2. The View should always look at the ship.
  3. It would be great if the camera would smooth a littlebit, so that, when the ship rotates and moves, the view doesn’t follow directly (e.g. viewPosition = ((shipPosition.x/y/z - vpSTARTX/vpSTARTY/vpSTARTZ)/CAMERASMOOTH); //vpSTARTX = 0.0f, vpSTARTY = 50.0f, vpSTARTZ = 130.0f, CAMERASMOOTH = 6.0f ).

What I tried:
I used the function viewTrans3d.setLookAt(viewPosition, shipPosition, vpUp);. shipPosition is clear and viewPosition is rotation.transform(new Transform3D(shipPosition.x/y/z - vpSTARTX/vpSTARTY/vpSTARTZ));

Problems:

  1. Because of the vpUP(0.0f,1.0f,0.0f);, my View y-axis looks Upwards everytime. But when I make a looping for example it looks like the ship is rotating around his z-axis, though only the View doesn’t follow this rotation!
  2. there’s no smooth, so the motion of the Ship looks very rigid (or stiff?Sorry, but I have looked up this words in a dictionary)and you can only see the movement by the movement of the background.

Greets,
Juan

[quote]I don’t know why everyone insists on using two transform groups for this. As long as you .mul them in the right order, one will do.
[/quote]
Well, I wasn’t stating that you had to do it that way. It was easier to point out that it matters if you do rotation or translation first. But you are right, you can do it with 1 TransformGroup. You can also do it with more then 1; it really depends on your app.

As for this Camera smoothing question - I’m not exactly sure what you are doing but I think I know what you want. I really can’t answere that question due to the lack of how things are setup for yea.