Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void flyTo(double xShapePos, double yShapePos) {
- float x = 0;
- // je nachdem, wem der Token gehört
- if (this._owner.getColor().equals(_colors[0])) {
- x = 1;
- } else if (this._owner.getColor().equals(_colors[1])) {
- x = -1;
- }
- Alpha alpha = new Alpha(-1, 5000);
- // Achse, um die gedreht werden soll
- Transform3D axisOfRotPos = new Transform3D();
- AxisAngle4f axis = new AxisAngle4f(1.0f, 0.0f, 0.0f, 0.0f); // oder normale tranform3d::rotX()
- axisOfRotPos.set(axis);
- // Zeitverhalten - Index der Stützstellen
- float[] knots = {0.0f, 0.5f, 0.7f, 1.0f};
- // Beschreibung der Orientierung
- Quat4f[] quats = new Quat4f[4];
- // quats[0] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
- // quats[1] = new Quat4f(1.0f, 0.0f, 0.0f, 0.0f);
- // quats[2] = new Quat4f(0.0f, 1.0f, 0.0f, 0.0f);
- // quats[3] = new Quat4f(0.0f, 1.0f, 1.0f, 0.0f);
- quats[0] = new Quat4f(0.0f, 0.0f, 0.0f, 0.0f);
- quats[1] = new Quat4f(0.0f, 0.0f, 0.0f, 0.0f);
- quats[2] = new Quat4f(0.0f, 1.0f, 0.0f, 0.0f);
- quats[3] = new Quat4f(0.0f, x, 1.0f, 0.0f);
- // Beschreibung der Position
- Transform3D ownTransf = new Transform3D();
- this.getTransform(ownTransf);
- Vector3f vtrans = new Vector3f();
- ownTransf.get(vtrans);
- Point3f[] positions = new Point3f[4];
- positions[0] = new Point3f(vtrans.x, vtrans.y, vtrans.z);
- positions[1] = new Point3f(vtrans.x, vtrans.y, vtrans.z+2);
- positions[2] = new Point3f((float) xShapePos, (float) xShapePos, vtrans.z+2);
- positions[3] = new Point3f((float) xShapePos, (float) yShapePos, 0.5f);
- RotPosPathInterpolator rotPosPath = new RotPosPathInterpolator(alpha, this, axisOfRotPos, knots, quats, positions);
- rotPosPath.setSchedulingBounds(new BoundingSphere());
- BranchGroup bg = new BranchGroup();
- bg.addChild(rotPosPath);
- this.addChild(bg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement