Vote count:
0
I'm trying to make an object fly over my scene in a square (which it does correctly) but I want it to face towards where it's going as well...
Problem is currently the object flies, and while flying it rotates (which is not natural). I'd like it to fly to a point, then stop and rotate, then fly to the next one, then rotate again and so on.
I'm trying to achieve this with the Java3D function: RotPosPathInterpolator
And this is what I'm doing:
Alpha alphaNave = new Alpha( -1, Alpha.INCREASING_ENABLE, 0,0,6000,0,0,0,0,0 );
TransformGroup target = new TransformGroup();
Transform3D axisOfRotPos = new Transform3D();
float[] alphas = {0.0f, 0.25f, 0.50f, 0.75f, 1.0f};
Quat4f[] quats = new Quat4f[5];
Point3f[] positions = new Point3f[5];
target.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
quats[0] = new Quat4f(0.0f, 1.0f, 0.0f, (float) Math.toRadians(0));
quats[1] = new Quat4f(0.0f, 1.0f, 0.0f, (float) Math.toRadians(90));
quats[2] = new Quat4f(0.0f, 1.0f, 0.0f, (float) Math.toRadians(180));
quats[3] = new Quat4f(0.0f, 1.0f, 0.0f, (float) Math.toRadians(270));
quats[4] = quats[0];
positions[0]= new Point3f( -20.0f, 0.0f, 20.0f);
positions[1]= new Point3f( -20.0f, 0.0f, -20.0f);
positions[2]= new Point3f( 20.0f, 0.0f, -20.0f);
positions[3]= new Point3f( 20.0f, 0.0f, 20.0f);
positions[4]= positions[0];
RotPosPathInterpolator rotPosPath = new RotPosPathInterpolator(
alphaNave, target, axisOfRotPos, alphas, quats, positions);
asked 1 min ago
Making a correct animation with java3D and rotpospathInterpolator
Aucun commentaire:
Enregistrer un commentaire