Hi All
I need a little advice from old and wise monkeys in here
I’m trying to modify HelloTerrainCollision example and make the camera walk on some predefined path (using MotionPath) taking into account the terrain structure (i.e. with bullet collision). for that I added a motionpath and connected the cam node (with CameraNode on cam). in simpleInitApp I added:
[java]
path = new MotionPath();
path.setCycle(true);
path.addWayPoint(new Vector3f(80, 2, 0));
path.addWayPoint(new Vector3f(0, 2, 80));
path.addWayPoint(new Vector3f(-80, 2, 0));
path.addWayPoint(new Vector3f(0, 2, -80));
path.setCurveTension(0.83f);
path.enableDebugShape(assetManager, rootNode);
camNode = new CameraNode("Motion cam", cam);
camNode.setControlDir(CameraControl.ControlDirection.SpatialToCamera);
camNode.setEnabled(true);
cameraMotionControl = new MotionEvent(camNode, path);
cameraMotionControl.setLoopMode(LoopMode.Loop);
//cameraMotionControl.setDuration(15f);
cameraMotionControl.setLookAt(player.getPhysicsLocation(), Vector3f.UNIT_Y);
cameraMotionControl.setDirectionType(MotionEvent.Direction.LookAt);
cameraMotionControl.play();
cameraMotionControl.setSpeed(1);
cameraMotionControl.setInitialDuration(10f);
[/java]
in update, the delta to a add to the camera is
[java]
camDir.set(cameraMotionControl.getDirection()).multLocal(0.06f);
walkDirection.addLocal(camDir);
[/java]
But, for some reason, cameraMotionControl.getDirection() returns a vector of zero no matter what I try…
Any idea ?
Thanks!