Hi monkeys, for the last weeks, I’ve been working on a cinematics system for JME3.
It’s not complete yet, but the basics are now set, and it’s ready to be tested by little monkeys
It’s been built with the idea of plugging it later with a graphic editor in JMP, but I tried to keep it simple to use by code for Eclipse users.
A Cinematic is an appstate. It needs a scene (a Node) containing everything that’s gonna take part in the cinematic.
The cinematic is a set of CinematicEvents, that are going to be triggered at a given time.
Here is the usage (pseudo code)
Cinematic cinematic = new Cinematic(sceneNode, duration);
sceneNode is the node containing the scene
duration is the duration of the cinematic
triggerTime is the time in seconds since the beginning of the cinematic when the cinematic event will start
cinematicEvent is the cinematic event.
There are several kind of implemented cinematic events:
PositionTrack : allow you to change the position of a spatial over time. It will move the spatial to destination in a given amount of time by linearly interpolating the position.
RotationTrack : same as position but for rotation
ScaleTrack : same as position and rotation but for scale.
- SoundTrack : allow to play a sound at a given time for the given duration
GuiTrack : Displays a nifty gui at a given time for the given duration. To use it you first need to bind the nifty xml to the cinematic like that
In the example I created a SubtitleTrack that extends GuiTrack that displays a subtitle in a nifty panel.
AnimationTrack : Allow to start a model animation at a given time (a character walking animation for example)
MotionTrack : Close to PositionTrack, but allow the use of MotionPath for non linear movements.
A motionPath is a list of several waypoints. A path is interpolated using Catmull-rom splines between the waypoints.
The Motion track allow a spatial to move along a MotionPath in a given duration.
There will be more track implemention, but of course, you can make your own CinematicEvent by extending AbstractCinematicEvent.
It implements the CinematicEvent interface and provides duration, time, speed, etc… management.
In the example I demonstrate how to use it for a fadeIn/fadeOut effect in combination with the FadeFilter.
The camera management is handle as follow :
you need to bind the camera to the cinematic like that
CameraNode camNode = cinematic.bindCamera(“topView”, cam);
You can then position the camNode anywhere and when calling for example
The Cinematic will give the control of the camera to this node, seeing the scene from its point of view (here at 6 seconds from the beginning).
Of course, you can attach this camNode to a MotionTrack to make any traveling you want.
There is an example of everything i’ve just describe in the test repo (TestCinematics). I recommend to look at it.
For now physics are not managed by the cinematic, but first i’d like you monkeys to test the basics
Like usual any feedback/idea/request is very welcome.