Hey,
I am using Motionpath and waypoints to move a cube from A to B.
If the cube passes a waypoint, he becomes slowlier. I don’t want this effect, so that the cube doesn’t change his speed passing a waypoint. How can I solve this problem?
My code:
[java]
path = new MotionPath();
path.addWayPoint(new Vector3f(10, 3, 0));
path.addWayPoint(new Vector3f(10, 3, 5));
path.addWayPoint(new Vector3f(10, 3, 10));
path.enableDebugShape(assetManager, rootNode);
path.setCurveTension(0.0f);
motionTrack = new MotionEvent(player2,path);
motionTrack.setDirectionType(MotionEvent.Direction.Path);
motionTrack_rh1.setLoopMode(LoopMode.Loop);
motionTrack_rh1.setEnabled(true);
path.setCycle(false);
motionTrack.setLoopMode(LoopMode.Loop);
motionTrack.setDirectionType(MotionEvent.Direction.LookAt);
motionTrack.setLookAt(player.getLocalTranslation(), Vector3f.UNIT_Y);
[/java]
Ah, the problem was path.setCurveTension(0.0f). you shouldn’t set that to 0.0.
You can have a linear path instead of a curve path.
path.setPathSplineType(SplineType.Linear);