Search in sources :

Example 11 with CameraNode

use of com.jme3.scene.CameraNode in project jmonkeyengine by jMonkeyEngine.

the class TestJaime method setupCinematic.

public void setupCinematic(final Node jaime) {
    cinematic = new Cinematic(rootNode, 60);
    stateManager.attach(cinematic);
    jaime.move(0, 0, -3);
    AnimationFactory af = new AnimationFactory(0.7f, "JumpForward");
    af.addTimeTranslation(0, new Vector3f(0, 0, -3));
    af.addTimeTranslation(0.35f, new Vector3f(0, 1, -1.5f));
    af.addTimeTranslation(0.7f, new Vector3f(0, 0, 0));
    jaime.getControl(AnimControl.class).addAnim(af.buildAnimation());
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle", 3, LoopMode.DontLoop));
    float jumpStart = cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "JumpStart", LoopMode.DontLoop));
    cinematic.addCinematicEvent(jumpStart + 0.2f, new AnimationEvent(jaime, "JumpForward", LoopMode.DontLoop, 1));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "JumpEnd", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Punches", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "SideKick", LoopMode.DontLoop));
    float camStart = cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Taunt", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle", 1, LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Wave", LoopMode.DontLoop));
    cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle", LoopMode.DontLoop));
    CameraNode camNode = cinematic.bindCamera("cam", cam);
    camNode.setLocalTranslation(new Vector3f(1.1f, 1.2f, 2.9f));
    camNode.lookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);
    MotionPath path = new MotionPath();
    path.addWayPoint(new Vector3f(1.1f, 1.2f, 2.9f));
    path.addWayPoint(new Vector3f(0f, 1.2f, 3.0f));
    path.addWayPoint(new Vector3f(-1.1f, 1.2f, 2.9f));
    path.enableDebugShape(assetManager, rootNode);
    path.setCurveTension(0.8f);
    MotionEvent camMotion = new MotionEvent(camNode, path, 6);
    camMotion.setDirectionType(MotionEvent.Direction.LookAt);
    camMotion.setLookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y);
    cinematic.addCinematicEvent(camStart, camMotion);
    cinematic.activateCamera(0, "cam");
    cinematic.fitDuration();
    cinematic.setSpeed(1.2f);
    cinematic.setLoopMode(LoopMode.Loop);
    cinematic.play();
}
Also used : AnimationEvent(com.jme3.cinematic.events.AnimationEvent) Cinematic(com.jme3.cinematic.Cinematic) AnimationFactory(com.jme3.animation.AnimationFactory) Vector3f(com.jme3.math.Vector3f) CameraNode(com.jme3.scene.CameraNode) MotionPath(com.jme3.cinematic.MotionPath) AnimControl(com.jme3.animation.AnimControl) MotionEvent(com.jme3.cinematic.events.MotionEvent)

Aggregations

CameraNode (com.jme3.scene.CameraNode)10 Vector3f (com.jme3.math.Vector3f)7 Node (com.jme3.scene.Node)5 MotionPath (com.jme3.cinematic.MotionPath)3 Quaternion (com.jme3.math.Quaternion)3 BulletAppState (com.jme3.bullet.BulletAppState)2 MotionEvent (com.jme3.cinematic.events.MotionEvent)2 Light (com.jme3.light.Light)2 Camera (com.jme3.renderer.Camera)2 Geometry (com.jme3.scene.Geometry)2 LightNode (com.jme3.scene.LightNode)2 Spatial (com.jme3.scene.Spatial)2 AnimationHelper (com.jme3.scene.plugins.blender.animations.AnimationHelper)2 ConstraintHelper (com.jme3.scene.plugins.blender.constraints.ConstraintHelper)2 Structure (com.jme3.scene.plugins.blender.file.Structure)2 MeshHelper (com.jme3.scene.plugins.blender.meshes.MeshHelper)2 TemporalMesh (com.jme3.scene.plugins.blender.meshes.TemporalMesh)2 AnimControl (com.jme3.animation.AnimControl)1 AnimationFactory (com.jme3.animation.AnimationFactory)1 BlenderKey (com.jme3.asset.BlenderKey)1