|
@@ -5,42 +5,43 @@
|
|
<div class="paragraph"><p>What is required for an animated model? (<a href="../../jme3/terminology.html#Animation">See also: Animation terminology</a>)</p></div>
|
|
<div class="paragraph"><p>What is required for an animated model? (<a href="../../jme3/terminology.html#Animation">See also: Animation terminology</a>)</p></div>
|
|
<div class="olist arabic"><ol class="arabic"><li><p>For each model, you have to segment the model into a skeleton (<strong>bone rigging</strong>).</p></li><li><p>For each motion, you have to specify how the animation distorts parts of the model (<strong>skinning</strong>).</p></li><li><p>For each animation, you have to specify a series of snapshots of how the bones are positioned (<strong>keyframes</strong>).</p></li><li><p>One model can contain several animations. You give every animation a name when you save it in the mesh editor.</p></li></ol></div>
|
|
<div class="olist arabic"><ol class="arabic"><li><p>For each model, you have to segment the model into a skeleton (<strong>bone rigging</strong>).</p></li><li><p>For each motion, you have to specify how the animation distorts parts of the model (<strong>skinning</strong>).</p></li><li><p>For each animation, you have to specify a series of snapshots of how the bones are positioned (<strong>keyframes</strong>).</p></li><li><p>One model can contain several animations. You give every animation a name when you save it in the mesh editor.</p></li></ol></div>
|
|
<div class="paragraph"><p>Unless you download free models, or buy them from a 3D artist, you must create your animated models in an <strong>external mesh editor</strong> (for example, Blender) yourself.</p></div>
|
|
<div class="paragraph"><p>Unless you download free models, or buy them from a 3D artist, you must create your animated models in an <strong>external mesh editor</strong> (for example, Blender) yourself.</p></div>
|
|
-<div class="ulist"><ul><li><p><a href="../../sdk/blender.html">Converting Blender Models to JME3 (.J3o files)</a></p></li><li><p><a href="http://www.youtube.com/user/aramakara">Video Series: Creating models in Blender, OgreMax, 3dsMax</a></p></li><li><p><a href="http://www.youtube.com/watch?v=NdjC9sCRV0s">Video: Creating and Exporting OgreXML Animations from Blender 2.61 to JME3 </a></p></li><li><p><a href="https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en">Scene Workflow: Exporting OgreXML scenes from Blender to JME3</a></p></li><li><p><a href="https://docs.google.com/leaf?id=0B9hhZie2D-fEYmRkMTYwN2YtMzQ0My00NTM4LThhOTYtZTk1MTRlYTNjYTc3&hl=en">Animation Workflow: Create Animated UV-Mapped OgreXML Models in Blender, and use them in JME3</a></p></li><li><p><a href="http://www.youtube.com/watch?v=IDHMWsu_PqA">Video: Creating Worlds with Instances in Blender</a></p></li></ul></div>
|
|
|
|
|
|
+<div class="ulist"><ul><li><p><a href="../../sdk/blender.html">Converting Blender Models to JME3 (.J3o files)</a></p></li><li><p><a href="http://www.youtube.com/watch?v=NdjC9sCRV0s">Video: Creating and Exporting OgreXML Animations from Blender 2.61 to JME3 </a></p></li><li><p><a href="https://docs.google.com/fileview?id=0B9hhZie2D-fENDBlZDU5MzgtNzlkYi00YmQzLTliNTQtNzZhYTJhYjEzNWNk&hl=en">Scene Workflow: Exporting OgreXML scenes from Blender to JME3</a></p></li><li><p><a href="https://docs.google.com/leaf?id=0B9hhZie2D-fEYmRkMTYwN2YtMzQ0My00NTM4LThhOTYtZTk1MTRlYTNjYTc3&hl=en">Animation Workflow: Create Animated UV-Mapped OgreXML Models in Blender, and use them in JME3</a></p></li><li><p><a href="http://www.youtube.com/watch?v=IDHMWsu_PqA">Video: Creating Worlds with Instances in Blender</a></p></li></ul></div>
|
|
<div class="paragraph"><p>What is required in your JME3-based Java class?</p></div>
|
|
<div class="paragraph"><p>What is required in your JME3-based Java class?</p></div>
|
|
-<div class="ulist"><ul><li><p>One Animation Control per animated model</p></li><li><p>As many Animation Channels per Control as you need to play your animations. In simple cases one channel is enough, sometimes you need two or more Channels per model to play gestures and motions in parallel.</p></li></ul></div></div></div>
|
|
|
|
-<div class="sect1"><h2 id="code-samples">Code Samples</h2><div class="sectionbody"><div class="ulist"><ul><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestSpatialAnim.java">TestSpatialAnim.java</a></p></li><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestBlenderAnim.java">TestBlenderAnim.java</a></p></li><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestBlenderObjectAnim.java">TestBlenderObjectAnim.java</a></p></li><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestOgreAnim.java">TestOgreAnim.java</a></p></li><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestOgreComplexAnim.java">TestOgreComplexAnim.java</a></p></li><li><p><a href="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestCustomAnim.java">TestCustomAnim.java</a></p></li></ul></div></div></div>
|
|
|
|
|
|
+<div class="ulist"><ul><li><p>One Animation Control per animated model.</p></li><li><p>As many Animation Channels per Control as you need to play your animations. In simple cases one channel is enough, sometimes you need two or more Channels per model to play gestures and motions in parallel.</p></li></ul></div></div></div>
|
|
|
|
+<div class="sect1"><h2 id="code-samples">Code Samples</h2><div class="sectionbody"><div class="ulist"><ul><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestSpatialAnim.java">TestSpatialAnim.java</a></p></li><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderAnim.java">TestBlenderAnim.java</a></p></li><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestBlenderObjectAnim.java">TestBlenderObjectAnim.java</a></p></li><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestOgreAnim.java">TestOgreAnim.java</a></p></li><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestOgreComplexAnim.java">TestOgreComplexAnim.java</a></p></li><li><p><a href="https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/model/anim/TestCustomAnim.java">TestCustomAnim.java</a></p></li></ul></div></div></div>
|
|
<div class="sect2"><h3 id="controlling-animations">Controlling Animations</h3><div class="sect2"><h3 id="the-animation-control">The Animation Control</h3><div class="paragraph"><p>Create one <code>com.jme3.animation.AnimControl</code> object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controls. The control object gives you access to the available animation sequences in the model.</p></div>
|
|
<div class="sect2"><h3 id="controlling-animations">Controlling Animations</h3><div class="sect2"><h3 id="the-animation-control">The Animation Control</h3><div class="paragraph"><p>Create one <code>com.jme3.animation.AnimControl</code> object in your JME3 application for each animated model that you want to control. You have to register each animated model to one of these Animation Controls. The control object gives you access to the available animation sequences in the model.</p></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> AnimControl playerControl; <span class="comment">// you need one Control per model</span>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> AnimControl playerControl; <span class="comment">// you need one Control per model</span>
|
|
Node player = (Node) assetManager.loadModel(<span class="string"><span class="delimiter">"</span><span class="content">Models/Oto/Oto.mesh.xml</span><span class="delimiter">"</span></span>); <span class="comment">// load a model</span>
|
|
Node player = (Node) assetManager.loadModel(<span class="string"><span class="delimiter">"</span><span class="content">Models/Oto/Oto.mesh.xml</span><span class="delimiter">"</span></span>); <span class="comment">// load a model</span>
|
|
playerControl = player.getControl(AnimControl.class); <span class="comment">// get control over this model</span>
|
|
playerControl = player.getControl(AnimControl.class); <span class="comment">// get control over this model</span>
|
|
playerControl.addListener(<span class="local-variable">this</span>); <span class="comment">// add listener</span></code></pre></div></div></div>
|
|
playerControl.addListener(<span class="local-variable">this</span>); <span class="comment">// add listener</span></code></pre></div></div></div>
|
|
<div class="sect2"><h3 id="animation-channels">Animation Channels</h3><div class="paragraph"><p>An Animation Control has several Animation Channels (<code>com.jme3.animation.AnimChannel</code>). Each channel can play one animation sequence at a time.</p></div>
|
|
<div class="sect2"><h3 id="animation-channels">Animation Channels</h3><div class="paragraph"><p>An Animation Control has several Animation Channels (<code>com.jme3.animation.AnimChannel</code>). Each channel can play one animation sequence at a time.</p></div>
|
|
-<div class="paragraph"><p>There often are situations where you want to run several animation sequences at the same time, e.g. “shooting while walking or “boxing while jumping. In this case, you create several channels, assign an animation to each, and play them in parallel.</p></div>
|
|
|
|
|
|
+<div class="paragraph"><p>There often are situations where you want to run several animation sequences at the same time, e.g. “shooting” while walking or “boxing” while jumping. In this case, you create several channels, assign an animation to each, and play them in parallel.</p></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> AnimChannel channel_walk = playerControl.createChannel();
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> AnimChannel channel_walk = playerControl.createChannel();
|
|
AnimChannel channel_jump = playerControl.createChannel();
|
|
AnimChannel channel_jump = playerControl.createChannel();
|
|
...</code></pre></div></div>
|
|
...</code></pre></div></div>
|
|
-<div class="paragraph"><p>To reset a Control, call <code>control.clearChannels();</code></p></div></div></div>
|
|
|
|
|
|
+<div class="paragraph"><p>To reset a Control, call <code>control.clearChannels()</code>.</p></div></div></div>
|
|
<div class="sect1"><h2 id="animation-control-properties">Animation Control Properties</h2><div class="sectionbody"><div class="paragraph"><p>The following information is available for an AnimControl.</p></div>
|
|
<div class="sect1"><h2 id="animation-control-properties">Animation Control Properties</h2><div class="sectionbody"><div class="paragraph"><p>The following information is available for an AnimControl.</p></div>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>createChannel()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns a new channel, controlling all bones by default.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getNumChannels()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The number of channels registered to this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getChannel(0)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Gets individual channels by index number. At most <code>getNumChannels()</code>.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>clearChannels()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Clear all channels in this control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addListener(animEventListener)<br>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>createChannel()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns a new channel, controlling all bones by default.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getNumChannels()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The number of channels registered to this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getChannel(0)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Gets individual channels by index number. At most <code>getNumChannels()</code>.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>clearChannels()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Clear all channels in this control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addListener(animEventListener)<br>
|
|
removeListener(animEventListener)<br>
|
|
removeListener(animEventListener)<br>
|
|
clearListeners()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Adds or removes listeners to receive animation related events.</p></div></div></td></tr></tbody></table>
|
|
clearListeners()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Adds or removes listeners to receive animation related events.</p></div></div></td></tr></tbody></table>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setAnimations(aniHashMap)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Sets the animations that this AnimControl is capable of playing. The animations must be compatible with the skeleton given in the constructor.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addAnim(boneAnim)<br>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setAnimations(aniHashMap)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Sets the animations that this AnimControl is capable of playing. The animations must be compatible with the skeleton given in the constructor.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addAnim(boneAnim)<br>
|
|
-removeAnim(boneAnim)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Adds or removes an animation from this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationNames()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>A String Collection of names of all animations that this Control can play for this model.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnim(“anim)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Retrieve an animation from the list of animations.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationLength(“anim)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns the length of the given named animation in seconds</p></div></div></td></tr></tbody></table>
|
|
|
|
-<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getSkeleton()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The Skeleton object controlled by this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getTargets()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The Skin objects controlled by this Control, as Mesh array.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAttachmentsNode(“bone)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone’s motions.</p></div></div></td></tr></tbody></table></div></div>
|
|
|
|
|
|
+removeAnim(boneAnim)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Adds or removes an animation from this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationNames()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>A String Collection of names of all animations that this Control can play for this model.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnim(“anim”)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Retrieve an animation from the list of animations.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationLength(“anim”)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns the length of the given named animation in seconds</p></div></div></td></tr></tbody></table>
|
|
|
|
+<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimControl Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getSkeleton()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The Skeleton object controlled by this Control.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getTargets()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The Skin objects controlled by this Control, as Mesh array.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAttachmentsNode(“bone”)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Returns the attachment node of a bone. Attach models and effects to this node to make them follow this bone’s motions.</p></div></div></td></tr></tbody></table></div></div>
|
|
<div class="sect1"><h2 id="animation-channel-properties">Animation Channel Properties</h2><div class="sectionbody"><div class="paragraph"><p>The following properties are set per AnimChannel.</p></div>
|
|
<div class="sect1"><h2 id="animation-channel-properties">Animation Channel Properties</h2><div class="sectionbody"><div class="paragraph"><p>The following properties are set per AnimChannel.</p></div>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.Loop);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will repeat from the beginning when it ends.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.DontLoop);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will play once, and the freeze at the last keyframe.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.Cycle);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will play forward, then backward, then again forward, and so on.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setSpeed(1f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, play this animation slower (<1f) or faster (>1f), or with default speed (1f).</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTime(1.3f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Fast-forward or rewind to a certain moment in time of this animation.</p></div></div></td></tr></tbody></table>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.Loop);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will repeat from the beginning when it ends.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.DontLoop);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will play once, and the freeze at the last keyframe.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setLoopMode(LoopMode.Cycle);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, the animation on this channel will play forward, then backward, then again forward, and so on.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setSpeed(1f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>From now on, play this animation slower (<1f) or faster (>1f), or with default speed (1f).</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>setTime(1.3f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Fast-forward or rewind to a certain moment in time of this animation.</p></div></div></td></tr></tbody></table>
|
|
<div class="paragraph"><p>The following information is available for a channel.</p></div>
|
|
<div class="paragraph"><p>The following information is available for a channel.</p></div>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationName()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The name of the animation playing on this channel. Returns <code>null</code> when no animation is playing.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getLoopMode()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The current loop mode on this channel. The returned com.jme3.animation enum can be LoopMode.Loop, LoopMode.DontLoop, or LoopMode.Cycle.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimMaxTime()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The total length of the animation on this channel. Or <code>0f</code> if nothing is playing.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getTime()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>How long the animation on this channel has been playing. It returns <code>0f</code> if the channel has not started playing yet, or a value up to getAnimMaxTime().</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getControl()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The AnimControl that belongs to this AnimChannel.</p></div></div></td></tr></tbody></table>
|
|
<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Property</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimationName()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The name of the animation playing on this channel. Returns <code>null</code> when no animation is playing.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getLoopMode()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The current loop mode on this channel. The returned com.jme3.animation enum can be LoopMode.Loop, LoopMode.DontLoop, or LoopMode.Cycle.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getAnimMaxTime()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The total length of the animation on this channel. Or <code>0f</code> if nothing is playing.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getTime()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>How long the animation on this channel has been playing. It returns <code>0f</code> if the channel has not started playing yet, or a value up to getAnimMaxTime().</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>getControl()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>The AnimControl that belongs to this AnimChannel.</p></div></div></td></tr></tbody></table>
|
|
<div class="paragraph"><p>Use the following methods to add or remove individual bones to an AnimChannel. This is useful when you play two animations in parallel on two channels, and each controls a subset of the bones (e.g. one the arms, and the other the legs).</p></div>
|
|
<div class="paragraph"><p>Use the following methods to add or remove individual bones to an AnimChannel. This is useful when you play two animations in parallel on two channels, and each controls a subset of the bones (e.g. one the arms, and the other the legs).</p></div>
|
|
-<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Methods</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addAllBones()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add all the bones of the model’s skeleton to be influenced by this animation channel. (default)</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addBone(“bone1)<br>
|
|
|
|
-addBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a single bone to be influenced by this animation channel.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addToRootBone(“bone1)<br>
|
|
|
|
-addToRootBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given bone, to the root bone.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addFromRootBone(“bone1)<br>
|
|
|
|
|
|
+<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">AnimChannel Methods</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addAllBones()</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add all the bones of the model’s skeleton to be influenced by this animation channel. (default)</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addBone(“bone1”)<br>
|
|
|
|
+addBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a single bone to be influenced by this animation channel.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addToRootBone(“bone1”)<br>
|
|
|
|
+addToRootBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given bone, to the root bone.</p></div></div></td></tr><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>addFromRootBone(“bone1”)<br>
|
|
addFromRootBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given root bone, going towards the children bones.</p></div></div></td></tr></tbody></table></div></div>
|
|
addFromRootBone(bone1)</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Add a series of bones to be influenced by this animation channel: Add all bones, starting from the given root bone, going towards the children bones.</p></div></div></td></tr></tbody></table></div></div>
|
|
-<div class="sect2"><h3 id="playing-animations">Playing Animations</h3><div class="paragraph"><p>Animations are played by channel. <strong>Note:</strong> Whether the animation channel plays continuously or only once, depends on the Loop properties you have set.</p></div>
|
|
|
|
-<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Channel Method</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>channel_walk.setAnim(“Walk,0.50f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Start the animation named “Walk on channel channel_walk.<br>
|
|
|
|
|
|
+<div class="sect2"><h3 id="playing-animations">Playing Animations</h3><div class="paragraph"><p>Animations are played by channel.</p></div>
|
|
|
|
+<div class="admonitionblock note"><table><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">Whether the animation channel plays continuously or only once, depends on the Loop properties you have set.</td></tr></table></div>
|
|
|
|
+<table class="tableblock frame-all grid-all spread"><colgroup><col style="width: 50%;"><col style="width: 50%;"></colgroup><thead><tr><th class="tableblock halign-left valign-top">Channel Method</th><th class="tableblock halign-left valign-top">Usage</th></tr></thead><tbody><tr><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>channel_walk.setAnim(“Walk”,0.50f);</p></div></div></td><td class="tableblock halign-left valign-top"><div><div class="paragraph"><p>Start the animation named “Walk” on channel channel_walk.<br>
|
|
The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.</p></div></div></td></tr></tbody></table>
|
|
The float value specifies the time how long the animation should overlap with the previous one on this channel. If set to 0f, then no blending will occur and the new animation will be applied instantly.</p></div></div></td></tr></tbody></table>
|
|
<div class="admonitionblock tip"><table><tr><td class="icon"><i class="fa icon-tip" title="Tip"></i></td><td class="content"><div class="paragraph"><p>Use the AnimEventLister below to react at the end or start of an animation cycle.</p></div></td></tr></table></div>
|
|
<div class="admonitionblock tip"><table><tr><td class="icon"><i class="fa icon-tip" title="Tip"></i></td><td class="content"><div class="paragraph"><p>Use the AnimEventLister below to react at the end or start of an animation cycle.</p></div></td></tr></table></div>
|
|
-<div class="sect2"><h3 id="usage-example">Usage Example</h3><div class="paragraph"><p>In this short example, we define the space key to trigger playing the “Walk animation on channel2.</p></div>
|
|
|
|
|
|
+<div class="sect2"><h3 id="usage-example">Usage Example</h3><div class="paragraph"><p>In this short example, we define the space key to trigger playing the “Walk” animation on channel2.</p></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> simpleInitApp() {
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> simpleInitApp() {
|
|
...
|
|
...
|
|
inputManager.addMapping(<span class="string"><span class="delimiter">"</span><span class="content">Walk</span><span class="delimiter">"</span></span>, <span class="keyword">new</span> KeyTrigger(KeyInput.KEY_SPACE));
|
|
inputManager.addMapping(<span class="string"><span class="delimiter">"</span><span class="content">Walk</span><span class="delimiter">"</span></span>, <span class="keyword">new</span> KeyTrigger(KeyInput.KEY_SPACE));
|
|
@@ -61,8 +62,8 @@ The float value specifies the time how long the animation should overlap with th
|
|
<div class="sect2"><h3 id="animation-event-listener">Animation Event Listener</h3><div class="paragraph"><p>A jME3 application that contains animations can implement the <code>com.jme3.animation.AnimEventListener</code> interface.</p></div>
|
|
<div class="sect2"><h3 id="animation-event-listener">Animation Event Listener</h3><div class="paragraph"><p>A jME3 application that contains animations can implement the <code>com.jme3.animation.AnimEventListener</code> interface.</p></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">HelloAnimation</span> <span class="directive">extends</span> SimpleApplication
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">HelloAnimation</span> <span class="directive">extends</span> SimpleApplication
|
|
<span class="directive">implements</span> AnimEventListener { ... }</code></pre></div></div>
|
|
<span class="directive">implements</span> AnimEventListener { ... }</code></pre></div></div>
|
|
-<div class="paragraph"><p>This optional Listener enables you to respond to animation start and end events, onAnimChange() and onAnimCycleDone().</p></div>
|
|
|
|
-<div class="sect2"><h3 id="responding-to-animation-end">Responding to Animation End</h3><div class="paragraph"><p>The onAnimCycleDone() event is invoked when an animation cycle has ended. For non-looping animations, this event is invoked when the animation is finished playing. For looping animations, this event is invoked each time the animation loop is restarted.</p></div>
|
|
|
|
|
|
+<div class="paragraph"><p>This optional Listener enables you to respond to animation start and end events, <code>onAnimChange()</code> and <code>onAnimCycleDone()</code>.</p></div>
|
|
|
|
+<div class="sect2"><h3 id="responding-to-animation-end">Responding to Animation End</h3><div class="paragraph"><p>The <code>onAnimCycleDone()</code> event is invoked when an animation cycle has ended. For non-looping animations, this event is invoked when the animation is finished playing. For looping animations, this event is invoked each time the animation loop is restarted.</p></div>
|
|
<div class="paragraph"><p>You have access to the following objects:</p></div>
|
|
<div class="paragraph"><p>You have access to the following objects:</p></div>
|
|
<div class="ulist"><ul><li><p>The Control to which the listener is assigned.</p></li><li><p>The animation channel being played.</p></li><li><p>The name of the animation that has just finished playing.</p></li></ul></div>
|
|
<div class="ulist"><ul><li><p>The Control to which the listener is assigned.</p></li><li><p>The animation channel being played.</p></li><li><p>The name of the animation that has just finished playing.</p></li></ul></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> onAnimCycleDone(AnimControl control, AnimChannel channel, <span class="predefined-type">String</span> animName) {
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> onAnimCycleDone(AnimControl control, AnimChannel channel, <span class="predefined-type">String</span> animName) {
|
|
@@ -72,8 +73,8 @@ The float value specifies the time how long the animation should overlap with th
|
|
channel.setAnim(<span class="string"><span class="delimiter">"</span><span class="content">Stand</span><span class="delimiter">"</span></span>, <span class="float">0.50f</span>);
|
|
channel.setAnim(<span class="string"><span class="delimiter">"</span><span class="content">Stand</span><span class="delimiter">"</span></span>, <span class="float">0.50f</span>);
|
|
}
|
|
}
|
|
}</code></pre></div></div></div>
|
|
}</code></pre></div></div></div>
|
|
-<div class="sect2"><h3 id="responding-to-animation-start">Responding to Animation Start</h3><div class="paragraph"><p>The onAnimChange() event is invoked every time before an animation is set by the user to be played on a given channel (<code>channel.setAnim()</code>).</p></div>
|
|
|
|
-<div class="paragraph"><p>You have access to the following objects</p></div>
|
|
|
|
|
|
+<div class="sect2"><h3 id="responding-to-animation-start">Responding to Animation Start</h3><div class="paragraph"><p>The <code>onAnimChange()</code> event is invoked every time before an animation is set by the user to be played on a given channel (<code>channel.setAnim()</code>).</p></div>
|
|
|
|
+<div class="paragraph"><p>You have access to the following objects:</p></div>
|
|
<div class="ulist"><ul><li><p>The Control to which the listener is assigned.</p></li><li><p>The animation channel being played.</p></li><li><p>The name of the animation that will start playing.</p></li></ul></div>
|
|
<div class="ulist"><ul><li><p>The Control to which the listener is assigned.</p></li><li><p>The animation channel being played.</p></li><li><p>The name of the animation that will start playing.</p></li></ul></div>
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> onAnimChange(AnimControl control, AnimChannel channel, <span class="predefined-type">String</span> animName) {
|
|
<div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="java"> <span class="directive">public</span> <span class="type">void</span> onAnimChange(AnimControl control, AnimChannel channel, <span class="predefined-type">String</span> animName) {
|
|
<span class="comment">// test for a condition you are interested in, e.g. ...</span>
|
|
<span class="comment">// test for a condition you are interested in, e.g. ...</span>
|
|
@@ -81,7 +82,7 @@ The float value specifies the time how long the animation should overlap with th
|
|
<span class="comment">// respond to the event here, e.g. ...</span>
|
|
<span class="comment">// respond to the event here, e.g. ...</span>
|
|
channel.setAnim(<span class="string"><span class="delimiter">"</span><span class="content">Reset</span><span class="delimiter">"</span></span>, <span class="float">0.50f</span>);
|
|
channel.setAnim(<span class="string"><span class="delimiter">"</span><span class="content">Reset</span><span class="delimiter">"</span></span>, <span class="float">0.50f</span>);
|
|
}
|
|
}
|
|
- }</code></pre></div></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2017-11-09 03:13:08 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
|
|
|
|
|
|
+ }</code></pre></div></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2017-11-14 05:28:25 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
|
|
apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
|
|
apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
|
|
indexName: 'jmonkeyengine',
|
|
indexName: 'jmonkeyengine',
|
|
inputSelector: '#doc-search',
|
|
inputSelector: '#doc-search',
|