Remove the fragile camNode.getControl(0).setEnabled()

and replaced it with camNode.setEnabled().
A) it is kind of scary to rely on the control index in
this case.
B) CameraNode.setEnabled() already calls setEnabled()
on the CameraControl.
An acceptable alternative would be:
camNode.getControl(CameraControl.class).setEnabled()
but I didn't see the point of it.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9267 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
PSp..om 2012-03-29 18:45:47 +00:00
parent 0e315d57da
commit 4e12127f27

View File

@ -73,7 +73,7 @@ public class TestCameraMotionPath extends SimpleApplication {
cam.setLocation(new Vector3f(8.4399185f, 11.189463f, 14.267577f));
camNode = new CameraNode("Motion cam", cam);
camNode.setControlDir(ControlDirection.SpatialToCamera);
camNode.getControl(0).setEnabled(false);
camNode.setEnabled(false);
path = new MotionPath();
path.setCycle(true);
path.addWayPoint(new Vector3f(20, 3, 0));
@ -170,11 +170,11 @@ public class TestCameraMotionPath extends SimpleApplication {
playing = false;
cameraMotionControl.stop();
chaser.setEnabled(true);
camNode.getControl(0).setEnabled(false);
camNode.setEnabled(false);
} else {
playing = true;
chaser.setEnabled(false);
camNode.getControl(0).setEnabled(true);
camNode.setEnabled(true);
cameraMotionControl.play();
}
}