Hello,
I am having a small issue with MotionPath and MotionEvent when creating a cinematic. I’ve found that when I am using waypoints which are placed at varying distances(different segment lengths), the camera moves at an inconsistent speed between different waypoints.
I have found that the shorter the segment length, the quicker the camera moves. As far as I can tell this seems to be something to do with the way that currentValue is calculated by the getWayPointIndexForDistance Method in MotionPath (currentValue increases considerably quicker for the shorter waypoints).
I was just wondering if 1) anyone else had had a similar issue before and how they managed to solve it. If not then what I am going to do is try and create an alternate method to calculate distance - in this case 2) is there an easy way to create local copies of libraries so that they can be edited - and is this a terrible idea?
I would like to note that I have checked the forum and found a similar problem which talks about setting curve tension but this seems to be unrelated.
I’ve attached a basic example which should show you what I mean:
[java]
private MotionEvent event;
private MotionPath path;
@Override
public void simpleInitApp() {
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
path = new MotionPath();
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
ChaseCamera chaseCam = new ChaseCamera(cam, geom, inputManager);
chaseCam.setDragToRotate(true);
chaseCam.setSmoothMotion(true);
chaseCam.setDefaultDistance(10f);
chaseCam.setMaxDistance(15f);
chaseCam.setMinDistance(10f);
chaseCam.setChasingSensitivity(5);
chaseCam.setRotationSpeed(5);
path.addWayPoint(new Vector3f(1, 1, 0 ));
path.addWayPoint(new Vector3f(1, 1, 50 ));
path.addWayPoint(new Vector3f(1, 1, 60 ));
path.addWayPoint(new Vector3f(1, 1, 70 ));
path.addWayPoint(new Vector3f(1, 1, 80 ));
path.addWayPoint(new Vector3f(1, 1, 110 ));
path.addWayPoint(new Vector3f(1, 1, 150 ));
path.addWayPoint(new Vector3f(1, 1, 250 ));
path.setCycle(true);
path.enableDebugShape(assetManager, rootNode);
event = new MotionEvent(geom, path);
event.setInitialDuration(1f*500);
event.setLoopMode(LoopMode.Loop);
event.setDirectionType(MotionEvent.Direction.Path);
event.play();
[/java]
Cheers,
Robin