Bonjour,

J'essaye en ce moment de modéliser une boule de bowling qui roule et qui avance.
Donc une rotation et une translation.

Après quelques recherches, j'ai trouvé la classe RotPosPathInterpolator.
Mais après quelques essais, je pense avoir compris que la rotation et la translation étaient synchronisées dans cette classe, c'est à dire que pour chaque "knot", la rotation et la translation réalisent un mouvement précis.

Or ma boule de bowling doit faire plusieurs tours avant d'atteindre la fin de la piste. Et la translation ne doit pas se répéter.

Donc ma question est comment faire deux mouvements indépendants l'un de l'autre ?

J'ai essayé avec deux TransformGroup de cette manière :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
BranchGroup objRoot=new BranchGroup();
TransformGroup TG=new TransformGroup();
TG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
TransformGroup tg1 = new TransformGroup () ;
tg1.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE) ;
TG.addChild (tg1) ;
Appearance sphereApp=mkAppWithTexture("bowling.jpg");
Sphere sphere=new Sphere(0.10f,Sphere.GENERATE_TEXTURE_COORDS,sphereApp); 
			tg1.addChild(sphere);
			 Alpha rotor1Alpha = new Alpha(-1,500);
			 Transform3D zAxis = new Transform3D();
			 zAxis.rotZ( 1.5708f );
RotationInterpolator rotator1 = new RotationInterpolator(rotor1Alpha,tg1,zAxis,0.0f, (float) Math.PI*2.0f);
			 rotator1.setSchedulingBounds(new BoundingSphere());
			tg1.addChild(rotator1);  
Transform3D trans = new Transform3D () ;
Alpha transAlpha = new Alpha (-1, 1000) ;
Point3f[] chemin=new Point3f[3];
chemin[0]=new Point3f(0.8f,0.0f,0.0f);
chemin[1]=new Point3f(-0.8f,0.0f,0.0f);
chemin[2]=new Point3f(0.8f,0.0f,0.0f);
float[] timePosition={0.0f,0.50f,1.0f};
PositionPathInterpolator interpol=new PositionPathInterpolator(transAlpha,tg1,trans,timePosition,chemin);
BoundingSphere transBounds=new BoundingSphere();
interpol.setSchedulingBounds(transBounds);
TG.addChild( interpol);
objRoot.addChild(TG);
Mais ça ne marche pas.

Une âme charitable pourrait-elle m'indiquer la marche à suivre ?

Merci d'avance.