|
@@ -1,24 +1,20 @@
|
|
|
= JME3 Cinematics
|
|
|
-:author:
|
|
|
-:revnumber:
|
|
|
-:revdate: 2016/03/17 20:48
|
|
|
-:relfileprefix: ../../
|
|
|
-:imagesdir: ../..
|
|
|
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
|
|
+:revnumber: 2.0
|
|
|
+:revdate: 2016/07/24
|
|
|
|
|
|
|
|
|
-JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. You can use cinematics to create link:http://en.wikipedia.org/wiki/Cutscene[cutscenes] and movies/trailers for your game. Another good use case is efficient “destruction physics: Playing back prerecorded flying pieces of debris for demolitions is much faster than calculating them with live physics.
|
|
|
+JME3 cinematics (com.jme.cinematic) allow you to remote control nodes and cameras in a 3D game: You can script and and play cinematic scenes. You can use cinematics to create link:http://en.wikipedia.org/wiki/Cutscene[cutscenes] and movies/trailers for your game. Another good use case is efficient "`destruction`" physics: Playing back prerecorded flying pieces of debris for demolitions is much faster than calculating them with live physics.
|
|
|
|
|
|
-Internally, Cinematics are implemented as <<jme3/advanced/application_states#,AppStates>>.
|
|
|
+Internally, Cinematics are implemented as <<jme3/advanced/application_states#,AppStates>>.
|
|
|
|
|
|
Short overview of the cinematic process:
|
|
|
|
|
|
. Plan the script of your movie. +
|
|
|
Write down a timeline (e.g. on paper) of which character should be at which spot at which time.
|
|
|
. Attach the scene objects that you want to remote-control to one Node. +
|
|
|
-This Node can be the rootNode, or a Node that is attached to the rootNode.
|
|
|
+This Node can be the rootNode, or a Node that is attached to the rootNode.
|
|
|
. Create a Cinematic object for this movie scene. The Cinematic will contain and manage the movie script.
|
|
|
-. For each line in your script (for each keyframe in your timeline), add a CinematicEvent to the Cinematic.
|
|
|
+. For each line in your script (for each keyframe in your timeline), add a CinematicEvent to the Cinematic.
|
|
|
|
|
|
|
|
|
== Sample Code
|
|
@@ -28,7 +24,7 @@ This Node can be the rootNode, or a Node that is attached to the rootNode.
|
|
|
|
|
|
== How to Use a Cinematic
|
|
|
|
|
|
-A Cinematic is like a movie script for a node.
|
|
|
+A Cinematic is like a movie script for a node.
|
|
|
|
|
|
[source,java]
|
|
|
----
|
|
@@ -46,11 +42,11 @@ stateManager.attach(cinematic);
|
|
|
** `duration` is the duration of the whole scene in seconds.
|
|
|
** Each Cinematic is a set of CinematicEvents, that are triggered at a given moment on the timeline.
|
|
|
|
|
|
-. Create one CinematicEvent for each line of your movie script.
|
|
|
+. Create one CinematicEvent for each line of your movie script.
|
|
|
** `event` is one motion of a moving object. You can add several events. More details below.
|
|
|
** `starttime` is the time when this particular cinematic event starts on the timeline. Specify the start time in seconds since the beginning of the cinematic.
|
|
|
|
|
|
-. Attach the Cinematic to the SimpleApplication's stateManager.
|
|
|
+. Attach the Cinematic to the SimpleApplication's stateManager.
|
|
|
. Play, stop and pause the Cinematic from your code.
|
|
|
|
|
|
[cols="2", options="header"]
|
|
@@ -83,13 +79,13 @@ a|Events(CinematicEvents)
|
|
|
a|Description
|
|
|
|
|
|
a|MotionEvent
|
|
|
-a|Use a MotionEvent to move a Spatial non-linearly over time. A MotionEvent is based on a list of waypoints in a MotionPath. The curve goes through each waypoint, and you can adjust the tension of the curve to modify the roundedness of the path. This is the motion interpolation you are going to use in most cases.
|
|
|
+a|Use a MotionEvent to move a Spatial non-linearly over time. A MotionEvent is based on a list of waypoints in a MotionPath. The curve goes through each waypoint, and you can adjust the tension of the curve to modify the roundedness of the path. This is the motion interpolation you are going to use in most cases.
|
|
|
|
|
|
a|SoundEvent
|
|
|
a|Use a SoundEvent to play a <<jme3/advanced/audio#,sound>> at a given time for the given duration.
|
|
|
|
|
|
a|GuiEvent
|
|
|
-a|Displays a <<jme3/advanced/nifty_gui#,Nifty GUI>> at a given time for the given duration. Use it to display subtitles or HUD elements. Bind the Nifty +++<abbr title="Graphical User Interface">GUI</abbr>+++ XML to the cinematic using `cinematic.bindUi(“path/to/nifty/file.xml);`
|
|
|
+a|Displays a xref:gui/nifty_gui.adoc[Nifty GUI] at a given time for the given duration. Use it to display subtitles or HUD elements. Bind the Nifty +++<abbr title="Graphical User Interface">GUI</abbr>+++ XML to the cinematic using `cinematic.bindUi("path/to/nifty/file.xml");`
|
|
|
|
|
|
a|AnimationEvent
|
|
|
a|Use this to start playing a model <<jme3/advanced/animation#,animation>> at a given time (a character walking animation for example)
|
|
@@ -160,7 +156,7 @@ Most likely you remote-control more than one object in your scene. Give the even
|
|
|
|
|
|
=== SoundEvent
|
|
|
|
|
|
-A SoundEventplays a sound as part of the cinematic.
|
|
|
+A SoundEventplays a sound as part of the cinematic.
|
|
|
|
|
|
[source,java]
|
|
|
----
|
|
@@ -169,7 +165,7 @@ SoundEvent( audioPath, isStream, duration, loopMode )
|
|
|
|
|
|
Details of the constructor:
|
|
|
|
|
|
-* `audioPath` is the path to an audio file as String, e.g. “Sounds/mySound.wav.
|
|
|
+* `audioPath` is the path to an audio file as String, e.g. "`Sounds/mySound.wav`".
|
|
|
* `isStream` toggles between streaming and buffering. Set to true to stream long audio file, set to false to play short buffered sounds.
|
|
|
* `duration` is the time that it should take to play.
|
|
|
* `loopMode` can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
|
|
@@ -193,7 +189,7 @@ cinematic.bindUi("Interface/subtitle.xml");
|
|
|
|
|
|
Details of the constructor:
|
|
|
|
|
|
-* `screen` is the name of the Nifty +++<abbr title="Graphical User Interface">GUI</abbr>+++ screen to load, as String.
|
|
|
+* `screen` is the name of the Nifty +++<abbr title="Graphical User Interface">GUI</abbr>+++ screen to load, as String.
|
|
|
* `duration` is the time that it should take to play.
|
|
|
* `loopMode` can be LoopMode.Loop, LoopMode.DontLoop, LoopMode.Cycle.
|
|
|
|
|
@@ -241,7 +237,7 @@ In the above example, I want it to be a top view of the scene looking at the wor
|
|
|
|
|
|
----
|
|
|
|
|
|
-Then i just have to schedule its activation in the cinematic. I want it to get activated 3 seconds after the start of the cinematic so I just have to do
|
|
|
+Then i just have to schedule its activation in the cinematic. I want it to get activated 3 seconds after the start of the cinematic so I just have to do
|
|
|
|
|
|
[source,java]
|
|
|
----
|