@ -72,12 +72,12 @@ A CollisionResult object contains information about the second party of the coll
<td>getTriangle(t)</td><td>Binds t to the triangle t on the second party's mesh that was hit.</td>
<td>getTriangle(t)</td><td>Binds t to the triangle t on the second party's mesh that was hit.</td>
</tr>
</tr>
<tr>
<tr>
<td>getTriangleIndex()</td><td>Returns the index of the triangle on the second party's mesh that was hit. (?)</td>
<td>getTriangleIndex()</td><td>Returns the index of the triangle on the second party's mesh that was hit.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT4 TABLE [2503-3040] -->
<!-- EDIT4 TABLE [2503-3036] -->
</div>
</div>
<!-- EDIT2 SECTION "Collidable" [1439-3041] -->
<!-- EDIT2 SECTION "Collidable" [1439-3037] -->
<h3><a>Code Sample</a></h3>
<h3><a>Code Sample</a></h3>
<div>
<div>
@ -132,13 +132,17 @@ Knowing the distance of the collisions is useful for example when you intersect
</p>
</p>
</div>
</div>
<!-- EDIT5 SECTION "Code Sample" [3042-5359] -->
<!-- EDIT5 SECTION "Code Sample" [3038-5355] -->
<h2><a>Bounding Volumes</a></h2>
<h2><a>Bounding Volumes</a></h2>
<div>
<div>
<p>
<p>
A com.jme3.bounding.BoundingVolume is an interface for dealing with containment of a collection of points. All BoundingVolumes are <code>Collidable</code> and are used as optimization to calculate non-physical collisions more quickly: It's always faster to calculate an intersection between simple shapes like spheres and boxes than between complex shapes like models.
A <code>com.jme3.bounding.BoundingVolume</code> is an interface for dealing with containment of a collection of points. All BoundingVolumes are <code>Collidable</code> and are used as optimization to calculate non-physical collisions more quickly: It's always faster to calculate an intersection between simple shapes like spheres and boxes than between complex shapes like models.
</p>
<p>
jME3 computes bounding volumes for all objects. These bounding volumes are later used for frustum culling, which is making sure only objects visible on-screen are actually sent for rendering.
</p>
</p>
<p>
<p>
@ -150,24 +154,25 @@ Supported types:
<imgsrc="/wiki/lib/exe/fetch.php">
<imgsrc="/wiki/lib/exe/fetch.php">
</p>
</p>
<ul>
<ul>
<li><div> Type.Sphere: com.jme3.bounding.BoundingSphere is a sphere used as a container for a group of vertices of a piece of geometry. A BoundingSphere has a center and a radius.</div>
<li><div> Type.AABB = Axis-aligned bounding box, that means it doesn't rotate, which makes it less precise. A <code>com.jme3.bounding.BoundingBox</code> is an axis-aligned cuboid used as a container for a group of vertices of a piece of geometry. A BoundingBox has a center and extents from that center along the x, y and z axis. This is the default bounding volume, since it is fairly fast to generate and gives better accuracy than the bounding sphere.</div>
</li>
</li>
<li><div> Type.AABB = Axis-aligned bounding box, that means it doesn't rotatewhich makes it less precise. A com.jme3.bounding.BoundingBox is an axis-aligned cuboid used as a container for a group of vertices of a piece of geometry. A BoundingBox has a center and extents from that center along the x, y and z axis.</div>
<li><div> Type.Sphere: <code>com.jme3.bounding.BoundingSphere</code> is a sphere used as a container for a group of vertices of a piece of geometry. A BoundingSphere has a center and a radius.</div>
</li>
</li>
<li><div> Type.OBB = Oriented bounding box. This bounding box is more precise because it can rotate with its content, but is computationally more expensive. (Currently not supported.)</div>
<li><div> Type.OBB = Oriented bounding box. This bounding box is more precise because it can rotate with its content, but is computationally more expensive. (Currently not supported.)</div>
</li>
</li>
<li><div> Type.Capsule = Cylinder with rounded ends, also called "swept sphere". Typically used for mobile characters.</div>
<li><div> Type.Capsule = Cylinder with rounded ends, also called "swept sphere". Typically used for mobile characters. (Currently not supported.)</div>
</li>
</li>
</ul>
</ul>
<p>
<p>
<p><div>Note: If you are looking for BoundingVolumes for physical objects, use <ahref="/com/jme3/gde/core/docs/jme3/advanced/physics.html">CollisionShapes</a>.
<p><div>Note: If you are looking for bounding volumes for physical objects, use <ahref="/com/jme3/gde/core/docs/jme3/advanced/physics.html">CollisionShapes</a>.
@ -180,13 +185,23 @@ For example you can use Bounding Volumes on custom meshes, or complex non-physic
mesh.updateBound();</pre>
mesh.updateBound();</pre>
</div>
</div>
<!-- EDIT7 SECTION "Usage" [7042-7223] -->
<!-- EDIT7 SECTION "Usage" [7400-7581] -->
<h2><a>Mesh and Scene Graph Collision</a></h2>
<div>
<p>
One of the supported <code>Collidable</code>s are meshes and scene graph objects. To execute a collision detection query against a scene graph, use <code>Spatial.collideWith()</code>. This will traverse the scene graph and return any mesh collisions that were detected. Note that the first collision against a particular scene graph may take a long time, this is because a special data structure called <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Bounding_interval_hierarchy"><paramname="text"value="<html><u>|Bounding Interval Hierarchy (BIH)</u></html>"><paramname="textColor"value="blue"></object> needs to be generated for the meshes. At a later point, the mesh could change and the BIH tree would become out of date, in that case, call <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/javadoc/com/jme3/scene/Mesh.html#createCollisionData()"><paramname="text"value="<html><u>Mesh.createCollisionData()</u></html>"><paramname="textColor"value="blue"></object> on the changed mesh to update the BIH tree.
</p>
</div>
<!-- EDIT8 SECTION "Mesh and Scene Graph Collision" [7582-8402] -->
<h2><a>Intersection</a></h2>
<h2><a>Intersection</a></h2>
<div>
<div>
<p>
<p>
A com.jme3.math.Ray is an infinite line with a beginning, a direction, and no end; whereas a com.jme3.math.Line is an infinite line with only a direction (no beginning, no end).
A <code>com.jme3.math.Ray</code> is an infinite line with a beginning, a direction, and no end; whereas a <code>com.jme3.math.Line</code> is an infinite line with only a direction (no beginning, no end).
</p>
</p>
<p>
<p>
@ -214,14 +229,12 @@ Learn the details of how to implement <a href="/com/jme3/gde/core/docs/jme3/adva
<li><div> A com.jme3.collision.SweepSphere implements a collidable "stretched" sphere that is shaped like a capsule (an upright cylinder with half a sphere on top and the second half at the bottom). This shape is usually used to simulate simple non-physcial collisions for character entities in games. The sweep sphere can be used to check collision against a triangle or another sweep sphere.</div>
@ -145,7 +145,7 @@ For example, you disable your IdleBehaviourControl when you enable your Defensiv
Usage: Your custom subclass implements the three methods <code>controlUpdate()</code>, <code>controlRender()</code>, <code>setSpatial()</code>, and <code>cloneForSpatial()</code> as shown here:
Usage: Your custom subclass implements the three methods <code>controlUpdate()</code>, <code>controlRender()</code>, <code>setSpatial()</code>, and <code>cloneForSpatial()</code> as shown here:
</p>
</p>
<pre>public class MyControl extends AbstractControl implements Savable, Cloneable {
<pre>public class MyControl extends AbstractControl implements Savable, Cloneable {
privat int index; // can have custom fields -- example
private int index; // can have custom fields -- example
public MyControl(){} // empty serialization constructor
public MyControl(){} // empty serialization constructor
<!-- EDIT8 SECTION "Using the Mesh in a Scene" [4321-4740] -->
<!-- EDIT8 SECTION "Using the Mesh in a Scene" [4321-4740] -->
<h2><a>Dynamic Meshes</a></h2>
<div>
<p>
If modifying a mesh dynamically in a way which would change the model's bounds then you need to call updateModelBound() on the Geometry object containing the mesh after calling updateBounds() on the mesh object. There is a warning on updateModelBounds about not usually needing to use it but that can be ignored in this special case.
<h1><a>jME3 Post-Processor Filters and Effects -- Overview</a></h1>
<h1><a>jME3 Special Effects Overview</a></h1>
<div>
<div>
<p>
<p>
jME3 supports two types of effects, post-rendering filters and particle emitters. This list contains screenshots and links to sample code that demonstrates how to add the effect to a scene.
jME3 supports several types of special effects: Post-Processor Filters, SceneProcessors, and Particle Emitters (also known as particle systems). This list contains screenshots and links to sample code that demonstrates how to add the effect to a scene.
</p>
</p>
<p>
</div>
For example, post-processor filter effects are typically activated after the following pattern:
<!-- EDIT1 SECTION "jME3 Special Effects Overview" [1-299] -->
</p>
<h2><a>Sample Code</a></h2>
<div>
<ul>
<li><div> There is one <code>com.jme3.effect.ParticleEmitter</code> class for all Particle Systems. </div>
</li>
<li><div> There is one <code>com.jme3.post.FilterPostProcessor</code> class and several <code>com.jme3.post.filters.*</code> classes (all Filters have <code>*Filter</code> in their names). </div>
</li>
<li><div> There are several <code>SceneProcessor</code> classes in various packages, including e.g. <code>com.jme3.shadow.*</code> and <code>com.jme3.water.*</code> (SceneProcessor have <code>*Processor</code> or <code>*Renderer</code> in their names).</div>
</li>
</ul>
</div>
<!-- EDIT2 SECTION "Sample Code" [300-768] -->
<h3><a>Particle Emitter</a></h3>
<div>
<pre>public class MyGame extends SimpleApplication {
<pre>public class MyGame extends SimpleApplication {
private FilterPostProcessor fpp;
public void simpleInitApp(){
private SomeFilter sf;
ParticleEmitter pm = new ParticleEmitter("my particle effect", Type.Triangle, 60);
Material pmMat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
The jMonkeyEngine features <ahref="/com/jme3/gde/core/docs/jme3/advanced/water.html">"SeaMonkey" water effect</a> including cool underwater caustics.
The jMonkeyEngine's <ahref="/com/jme3/gde/core/docs/jme3/advanced/water.html">"SeaMonkey" WaterFilter</a> simulates ocean waves, foam, including cool underwater caustics.
Use the SimpleWaterProcessor (SceneProcessor) for small, limited bodies of water, such as puddles, drinking troughs, pools, fountains.
</p>
</p>
<p>
<p>
See also the <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/2011/01/15/new-advanced-water-effect-for-jmonkeyengine-3"><paramname="text"value="<html><u>Rendering Water as Post-Process Effect</u></html>"><paramname="textColor"value="blue"></object> announcement with video.
See also the <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/2011/01/15/new-advanced-water-effect-for-jmonkeyengine-3"><paramname="text"value="<html><u>Rendering Water as Post-Process Effect</u></html>"><paramname="textColor"value="blue"></object> announcement with video.
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/TestPssmShadow.java"><paramname="text"value="<html><u>jme3/src/test/jme3test/light/TestPssmShadow.java</u></html>"><paramname="textColor"value="blue"></object> – PssmShadowRenderer (SceneProcessor), also known as Parallel-Split Shadow Mapping (PSSM).</div>
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/post/TestSSAO.java"><paramname="text"value="<html><u>jme3/src/test/jme3test/post/TestSSAO.java</u></html>"><paramname="textColor"value="blue"></object>, <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/post/TestSSAO2.java"><paramname="text"value="<html><u>jme3/src/test/jme3test/post/TestSSAO2.java</u></html>"><paramname="textColor"value="blue"></object> – SSAOFilter, also known as Screen-Space Ambient Occlusion shadows (SSOA).</div>
</li>
</li>
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/post/TestTransparentSSAO.java"><paramname="text"value="<html><u>jme3/src/test/jme3test/post/TestTransparentSSAO.java</u></html>"><paramname="textColor"value="blue"></object> – Screen-Space Ambient Occlusion shadows plus transparancy</div>
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/post/TestTransparentSSAO.java"><paramname="text"value="<html><u>jme3/src/test/jme3test/post/TestTransparentSSAO.java</u></html>"><paramname="textColor"value="blue"></object> – SSAOFilter, also known as Screen-Space Ambient Occlusion shadows (SSOA), plus transparancy</div>
</li>
</li>
<li><div> More details: <ahref="/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html">Light and Shadow</a></div>
<li><div> More details: <ahref="/com/jme3/gde/core/docs/jme3/advanced/light_and_shadow.html">Light and Shadow</a></div>
<ahref="/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html">Particle emitter effects</a>can have any texture, e.g. fog, smoke, leaves, meteors, snowflakes, mosquitos, fire, sparks…
<ahref="/com/jme3/gde/core/docs/jme3/advanced/particle_emitters.html">Particle emitter effects</a>are highly configurable and can have any texture. They can simulate smoke, dust, leaves, meteors, snowflakes, mosquitos, fire, explosions, clusters, embers, sparks…
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); </td><td>Activate back-face culling. Mesh faces that are not facing the camera are not rendered, which saves time. Backface culling is activated by default as a major optimization.</td><td>The backside of mesh polygons (and the inside of models) is invisible. </td>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); </td><td>Activates back-face culling. Mesh faces that are facing away from the camera are not rendered, which saves time. *Backface culling is activated by default as a major optimization.* </td><td>The invisible backsides and insides of models are not calculated. </td>
</tr>
</tr>
<tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); </td><td>Nothing is culled. Both mesh faces are rendered, even if they face away from the camera. Slow.</td><td>Sometimes used to debug custom meshes if you messed up some of the polygon sides, or for special shadow effects.</td>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); </td><td>No meshes are culled. Both mesh faces are rendered, even if they face away from the camera. Slow.</td><td>Sometimes used to debug custom meshes if you messed up some of the polygon sides, or for special shadow effects.</td>
</tr>
</tr>
<tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); </td><td>Activate front-face culling. Mesh faces facing the camera are not rendered.</td><td>Typically not used because you wouldn't see anything.</td>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front); </td><td>Activates front-face culling. Mesh faces facing the camera are not rendered.</td><td>No example – Typically not used because you wouldn't see anything meaningful.</td>
</tr>
</tr>
<tr>
<tr>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack)</td><td>Cull both backfaces and frontfaces.</td><td>Use this as an efficient way to make an object temporarily invisible, while keeping all its other in-game properties (node attachment, collision shapes, interactions, etc) active.</td>
<td>getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack)</td><td>Culls both backfaces and frontfaces.</td><td>Use this as an efficient way to make an object temporarily invisible, while keeping all its other in-game properties (such as node attachment, collision shapes, interactions, etc) active.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT15 TABLE [13385-14484] -->
<!-- EDIT15 TABLE [13385-14527] -->
</div>
</div>
<!-- EDIT14 SECTION "Culling" [13366-14485] -->
<!-- EDIT14 SECTION "Culling" [13366-14528] -->
<h3><a>Miscellaneous</a></h3>
<h3><a>Miscellaneous</a></h3>
<div>
<div>
<div><table>
<div><table>
@ -368,7 +368,7 @@ Later, put the Geometry (not the Material!) in the appropriate render queue
<td>getAdditionalRenderState().setPolyOffset();</td><td>Enable polygon offset.</td><td>Use this when you have meshes that have triangles really close to each over (e.g. <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Coplanarity"><paramname="text"value="<html><u>Coplanar</u></html>"><paramname="textColor"value="blue"></object>), it will shift the depth values to prevent <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Z-fighting"><paramname="text"value="<html><u>Z-fighting</u></html>"><paramname="textColor"value="blue"></object>.</td>
<td>getAdditionalRenderState().setPolyOffset();</td><td>Enable polygon offset.</td><td>Use this when you have meshes that have triangles really close to each over (e.g. <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Coplanarity"><paramname="text"value="<html><u>Coplanar</u></html>"><paramname="textColor"value="blue"></object>), it will shift the depth values to prevent <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Z-fighting"><paramname="text"value="<html><u>Z-fighting</u></html>"><paramname="textColor"value="blue"></object>.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT17 TABLE [14511-15277] -->
<!-- EDIT17 TABLE [14554-15320] -->
<p>
<p>
<strong>Related Links</strong>
<strong>Related Links</strong>
@ -389,7 +389,7 @@ Later, put the Geometry (not the Material!) in the appropriate render queue
@ -72,8 +72,19 @@ ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(4)
Pool size means the executor will keep four threads alive at any time. Having more threads in the pool means that more tasks can run concurrently. But a bigger pool only results in a speed gain if the PC can handle it! Allocating a pool that is uselessly large just wastes memory, so you need to find a good compromise: About the same to double the size of the number of cores in the computer makes sense.
Pool size means the executor will keep four threads alive at any time. Having more threads in the pool means that more tasks can run concurrently. But a bigger pool only results in a speed gain if the PC can handle it! Allocating a pool that is uselessly large just wastes memory, so you need to find a good compromise: About the same to double the size of the number of cores in the computer makes sense.
</p>
</p>
<p>
!!! Executor needs to be shut down when the application ends, in order to make the process die properly
In your simple application you can override the stop method and shutdown the executor :
</p>
<pre> @Override
public void stop(){
super.stop();
executor.shutdown();
}</pre>
</div>
</div>
<!-- EDIT4 SECTION "Executor" [2879-3637] -->
<!-- EDIT4 SECTION "Executor" [2879-3946] -->
<h3><a>Control Class Fields</a></h3>
<h3><a>Control Class Fields</a></h3>
<div>
<div>
@ -93,7 +104,7 @@ Here we also created the Future variable to track the state of this task.
</p>
</p>
</div>
</div>
<!-- EDIT5 SECTION "Control Class Fields" [3638-4228] -->
<!-- EDIT5 SECTION "Control Class Fields" [3947-4537] -->
<h3><a>Control Update() Method</a></h3>
<h3><a>Control Update() Method</a></h3>
<div>
<div>
@ -141,7 +152,7 @@ Remember not to mess with the class fields after starting the thread, because th
@ -69,7 +69,7 @@ You can register several types of listeners to be notified of changes.
The game server is a "headless" com.jme3.app.SimpleApplication:
The game server is a "headless" com.jme3.app.SimpleApplication:
</p>
</p>
<pre>public class MyGameServer extends SimpleApplication {
<pre>public class ServerMain extends SimpleApplication {
public static void main(String[] args){
public static void main(String[] args){
ServerMain app = new ServerMain();
ServerMain app = new ServerMain();
app.start(JmeContext.Type.Headless); // headless type for servers!
app.start(JmeContext.Type.Headless); // headless type for servers!
@ -96,7 +96,7 @@ When you run this app on a host, the server is ready to accept clients. Let'
</p>
</p>
</div>
</div>
<!-- EDIT5 SECTION "Creating a Server" [2418-3370] -->
<!-- EDIT5 SECTION "Creating a Server" [2418-3368] -->
<h3><a>Creating a Client</a></h3>
<h3><a>Creating a Client</a></h3>
<div>
<div>
@ -104,7 +104,7 @@ When you run this app on a host, the server is ready to accept clients. Let'
A game client is a standard com.jme3.app.SimpleApplication.
A game client is a standard com.jme3.app.SimpleApplication.
</p>
</p>
<pre>public class MyGameClient extends SimpleApplication {
<pre>public class ClientMain extends SimpleApplication {
public static void main(String[] args){
public static void main(String[] args){
ClientMain app = new ClientMain();
ClientMain app = new ClientMain();
app.start(JmeContext.Type.Display); // standard display type
app.start(JmeContext.Type.Display); // standard display type
@ -135,7 +135,7 @@ When you run this client, it connects to the server.
</p>
</p>
</div>
</div>
<!-- EDIT6 SECTION "Creating a Client" [3371-4538] -->
<!-- EDIT6 SECTION "Creating a Client" [3369-4534] -->
<h3><a>Getting Info About a Client</a></h3>
<h3><a>Getting Info About a Client</a></h3>
<div>
<div>
@ -158,7 +158,7 @@ The server refers to a connected client as com.jme3.network.HostedConnection obj
<td>myServer.getConnection(0)</td><td>Server gets the first (0), second (1), etc, connected HostedConnection object (one client).</td>
<td>myServer.getConnection(0)</td><td>Server gets the first (0), second (1), etc, connected HostedConnection object (one client).</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT8 TABLE [4715-5094] -->
<!-- EDIT8 TABLE [4711-5090] -->
<p>
<p>
Your game can define its own game data based on whatever criteria you want, typically these include player ID and state. If the server needs to look up player/client-specific information, you can store this information directly on the HostedConnection object. The following examples read and write a custom Java object <code>MyState</code> in the HostedConnection object <code>conn</code>:
Your game can define its own game data based on whatever criteria you want, typically these include player ID and state. If the server needs to look up player/client-specific information, you can store this information directly on the HostedConnection object. The following examples read and write a custom Java object <code>MyState</code> in the HostedConnection object <code>conn</code>:
@ -175,14 +175,14 @@ Your game can define its own game data based on whatever criteria you want, typi
<td> MyState state = conn.getAttribute("MyState")</td><td> Server can read an attribute of the HostedConnection. </td>
<td> MyState state = conn.getAttribute("MyState")</td><td> Server can read an attribute of the HostedConnection. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT9 TABLE [5469-5698] -->
<!-- EDIT9 TABLE [5465-5694] -->
</div>
</div>
<!-- EDIT7 SECTION "Getting Info About a Client" [4539-5699] -->
<!-- EDIT7 SECTION "Getting Info About a Client" [4535-5695] -->
<h2><a>Messaging</a></h2>
<h2><a>Messaging</a></h2>
<div>
<div>
</div>
</div>
<!-- EDIT10 SECTION "Messaging" [5700-5722] -->
<!-- EDIT10 SECTION "Messaging" [5696-5718] -->
<h3><a>Creating Message Types</a></h3>
<h3><a>Creating Message Types</a></h3>
<div>
<div>
@ -203,7 +203,7 @@ You must register each message type to the com.jme3.network.serializing.Serializ
<!-- EDIT12 SECTION "Responding to Messages" [6676-8420] -->
<!-- EDIT12 SECTION "Responding to Messages" [6672-8416] -->
<h3><a>Creating and Sending Messages</a></h3>
<h3><a>Creating and Sending Messages</a></h3>
<div>
<div>
@ -297,7 +297,7 @@ The last two broadcasting methods use com.jme3.network.Filters to select a subse
</p>
</p>
</div>
</div>
<!-- EDIT13 SECTION "Creating and Sending Messages" [8421-9510] -->
<!-- EDIT13 SECTION "Creating and Sending Messages" [8417-9506] -->
<h2><a>Identification and Rejection</a></h2>
<h2><a>Identification and Rejection</a></h2>
<div>
<div>
@ -328,7 +328,7 @@ A server has a game version and game name property. Each client expects to commu
<td> myClient.getVersion() </td><td> Client queries the version of the server it is connected to. </td>
<td> myClient.getVersion() </td><td> Client queries the version of the server it is connected to. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT15 TABLE [10102-10471] -->
<!-- EDIT15 TABLE [10098-10467] -->
<p>
<p>
<p><div>Typically, your networked game defines its own attributes (such as player ID) based on whatever criteria you want. If you want to look up player/client-specific information beyond the game version, you can set this information directly on the Client/HostedConnection object (see Getting Info About a Client).
<p><div>Typically, your networked game defines its own attributes (such as player ID) based on whatever criteria you want. If you want to look up player/client-specific information beyond the game version, you can set this information directly on the Client/HostedConnection object (see Getting Info About a Client).
@ -336,12 +336,12 @@ A server has a game version and game name property. Each client expects to commu
</p>
</p>
</div>
</div>
<!-- EDIT14 SECTION "Identification and Rejection" [9511-10799] -->
<!-- EDIT14 SECTION "Identification and Rejection" [9507-10795] -->
<h2><a>Closing Clients and Server Cleanly</a></h2>
<h2><a>Closing Clients and Server Cleanly</a></h2>
<div>
<div>
</div>
</div>
<!-- EDIT16 SECTION "Closing Clients and Server Cleanly" [10800-10846] -->
<!-- EDIT16 SECTION "Closing Clients and Server Cleanly" [10796-10842] -->
<h3><a>Closing a Client</a></h3>
<h3><a>Closing a Client</a></h3>
<div>
<div>
@ -357,7 +357,7 @@ You must override the client's destroy() method to close the connection cle
}</pre>
}</pre>
</div>
</div>
<!-- EDIT17 SECTION "Closing a Client" [10847-11122] -->
<!-- EDIT17 SECTION "Closing a Client" [10843-11118] -->
<h3><a>Closing a Server</a></h3>
<h3><a>Closing a Server</a></h3>
<div>
<div>
@ -373,7 +373,7 @@ You must override the server's destroy() method to close the connection whe
}</pre>
}</pre>
</div>
</div>
<!-- EDIT18 SECTION "Closing a Server" [11123-11379] -->
<!-- EDIT18 SECTION "Closing a Server" [11119-11375] -->
<h3><a>Kicking a Client</a></h3>
<h3><a>Kicking a Client</a></h3>
<div>
<div>
@ -384,7 +384,7 @@ The server can kick a HostedConnection to make it disconnect. You should provide
<!-- EDIT19 SECTION "Kicking a Client" [11380-11770] -->
<!-- EDIT19 SECTION "Kicking a Client" [11376-11766] -->
<h2><a>Listening to Connection Notification</a></h2>
<h2><a>Listening to Connection Notification</a></h2>
<div>
<div>
@ -394,7 +394,7 @@ The server and clients are notified about connection changes.
</p>
</p>
</div>
</div>
<!-- EDIT20 SECTION "Listening to Connection Notification" [11771-11882] -->
<!-- EDIT20 SECTION "Listening to Connection Notification" [11767-11878] -->
<h3><a>ClientStateListener</a></h3>
<h3><a>ClientStateListener</a></h3>
<div>
<div>
@ -414,7 +414,7 @@ The com.jme3.network.ClientStateListener notifies the Client when the Client has
<td> public void clientDisconnected(Client c, DisconnectInfo info){} </td><td> Implement here what happens after the server kicks this client. For example, display the DisconnectInfo to the user. </td>
<td> public void clientDisconnected(Client c, DisconnectInfo info){} </td><td> Implement here what happens after the server kicks this client. For example, display the DisconnectInfo to the user. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT22 TABLE [12125-12494] -->
<!-- EDIT22 TABLE [12121-12490] -->
<p>
<p>
First implement the ClientStateListener interface in the Client class. Then register it to myClient in MyGameClient's simpleInitApp() method:
First implement the ClientStateListener interface in the Client class. Then register it to myClient in MyGameClient's simpleInitApp() method:
@ -422,7 +422,7 @@ First implement the ClientStateListener interface in the Client class. Then regi
@ -442,7 +442,7 @@ The com.jme3.network.ConnectionListener notifies the Server whenever new HostedC
<td> public void connectionRemoved(Server s, HostedConnection c){} </td><td> Implement here what happens after a HostedConnection has left. E.g. a player has quit the game and the server removes his character. </td>
<td> public void connectionRemoved(Server s, HostedConnection c){} </td><td> Implement here what happens after a HostedConnection has left. E.g. a player has quit the game and the server removes his character. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT24 TABLE [12962-13360] -->
<!-- EDIT24 TABLE [12958-13356] -->
<p>
<p>
First implement the ConnectionListener interface in the Server class. Then register it to myServer in MyGameServer's simpleInitApp() method.
First implement the ConnectionListener interface in the Server class. Then register it to myServer in MyGameServer's simpleInitApp() method.
@ -451,7 +451,7 @@ First implement the ConnectionListener interface in the Server class. Then regis
@ -12,7 +12,7 @@ The awesome SeaMonkey WaterFilter is highly configurable. It can render any type
</p>
</p>
<p>
<p>
<p><div>The SeaMonkey WaterFilter is ideal for oceans and lakes, and expecially for under-water scenes. If you only need a small simple water surface, such as a water trough or a shallow fountain, the <ahref="/com/jme3/gde/core/docs/jme3/advanced/water.html">SimpleWaterProcessor</a> may already be all you need.
<p><div>The SeaMonkey WaterFilter is ideal for oceans and lakes, and especially for under-water scenes. If you only need a small simple water surface, such as a water trough or a shallow fountain, the <ahref="/com/jme3/gde/core/docs/jme3/advanced/water.html">SimpleWaterProcessor</a> may already be all you need.
</div></p>
</div></p>
</p>
</p>
@ -286,7 +286,7 @@ See also:
<ul>
<ul>
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/2011/01/15/new-advanced-water-effect-for-jmonkeyengine-3/#comment-609"><paramname="text"value="<html><u>JME3's Water Post-Process Effect</u></html>"><paramname="textColor"value="blue"></object> by Nehon</div>
<li><div><objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/2011/01/15/new-advanced-water-effect-for-jmonkeyengine-3/#comment-609"><paramname="text"value="<html><u>JME3's Water Post-Process Effect</u></html>"><paramname="textColor"value="blue"></object> by Nehon</div>
@ -186,6 +186,13 @@ rootNode.attachChild(geom); // attach geometry to a n
* <ahref="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a> – The GeometryBatchFactory class combines several of your shapes with the same texture into one mesh with one texture.
* <ahref="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a> – The GeometryBatchFactory class combines several of your shapes with the same texture into one mesh with one texture.
@ -22,7 +22,7 @@ If you think you need to understand the scene graph concept better, please read
<p>
<p>
In your Java code, a Spatial is either a <code>com.jme3.scene.Node</code> or a <code>com.jme3.scene.Geometry</code> instance. You use the two types of Spatials for different purposes:
In your Java code, a Spatial is either an instance of<code>com.jme3.scene.Node</code> or a <code>com.jme3.scene.Geometry</code> instance. You use the two types of Spatials for different purposes:
</p>
</p>
<p>
<p>
@ -34,7 +34,7 @@ In your Java code, a Spatial is either a <code>com.jme3.scene.Node</code> or a <
<td></td><th>com.jme3.scene.Spatial </th>
<td></td><th>com.jme3.scene.Spatial </th>
</tr>
</tr>
<tr>
<tr>
<th> Purpose: </th><td> A Spatial is an abstract data structure that stores transformations (= translation, rotation, scale) of elements of the 3D scene graph. Spatials can be saved and loaded using the <ahref="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>. </td>
<th> Purpose: </th><td> A Spatial is an abstract data structure that stores user data and transformations (= translation, rotation, scale) of elements of the 3D scene graph. Spatials can be saved and loaded using the <ahref="/com/jme3/gde/core/docs/jme3/advanced/asset_manager.html">Asset Manager</a>. </td>
<th> Examples: </th><td> Box, sphere, player, building, terrain, vehicle, missiles, NPCs, etc… </td><td> rootNode, guiNode, audioNode, a custom grouping node such as vehicleNode or shipNode with passengers attached, etc. </td>
<th> Examples: </th><td> Box, sphere, player, building, terrain, vehicle, missiles, NPCs, etc… </td><td> rootNode, guiNode, audioNode, a custom grouping node such as vehicleNode or shipNode with passengers attached, etc. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT3 TABLE [1178-2522] -->
<!-- EDIT3 TABLE [1191-2549] -->
<p>
<p>
<p><div>You never create a Spatial with <code><del>Spatial s = new Spatial();</del></code>! A Spatial is an abstract concept, like a mammal (there is no actual creature called "mammal" walking around here). You create either a com.jme3.scene.Node, or a com.jme3.scene.Geometry object. Some methods, however, require a spatial as argument: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you simply <em>cast</em> a Node or Geometry to Spatial.
<p><div>You never create a Spatial with <code><del>Spatial s = new Spatial();</del></code>! A Spatial is an abstract concept, like a mammal (there is no actual creature called "mammal" walking around here). You create either a com.jme3.scene.Node or com.jme3.scene.Geometry instance. Some methods, however, require a <code>Spatial</code> type as argument: This is because they are able to accept both Nodes and Geometries as arguments. In this case, you simply <em>cast</em> a Node or Geometry to Spatial.
</div></p>
</div></p>
</p>
</p>
</div>
</div>
<!-- EDIT2 SECTION "Node versus Geometry" [935-3014] -->
<!-- EDIT2 SECTION "Node versus Geometry" [935-3049] -->
<h3><a>Mesh</a></h3>
<h3><a>Mesh</a></h3>
<div>
<div>
@ -83,7 +83,7 @@ The polygon <a href="/com/jme3/gde/core/docs/jme3/advanced/mesh.html">Mesh</a> i
</ul>
</ul>
</div>
</div>
<!-- EDIT4 SECTION "Mesh" [3015-3694] -->
<!-- EDIT4 SECTION "Mesh" [3050-3729] -->
<h2><a>What is a Clone?</a></h2>
<h2><a>What is a Clone?</a></h2>
<div>
<div>
@ -112,7 +112,7 @@ Usually there is no need to manually use any of the <code>clone()</code> methods
</p>
</p>
</div>
</div>
<!-- EDIT5 SECTION "What is a Clone?" [3695-4950] -->
<!-- EDIT5 SECTION "What is a Clone?" [3730-4985] -->
<h2><a>How to Add Fields and Methods to a Spatial</a></h2>
<h2><a>How to Add Fields and Methods to a Spatial</a></h2>
<div>
<div>
@ -171,7 +171,7 @@ This is how you list all data keys that are already defined for one Spatial:
}</pre>
}</pre>
</div>
</div>
<!-- EDIT6 SECTION "How to Add Fields and Methods to a Spatial" [4951-7527] -->
<!-- EDIT6 SECTION "How to Add Fields and Methods to a Spatial" [4986-7562] -->
<h2><a>How to Access a Named Sub-Mesh</a></h2>
<h2><a>How to Access a Named Sub-Mesh</a></h2>
<div>
<div>
@ -196,15 +196,23 @@ In the following example, the Node <code>house</code> is the loaded model. The s
<!-- EDIT7 SECTION "How to Access a Named Sub-Mesh" [7528-8331] -->
<!-- EDIT7 SECTION "How to Access a Named Sub-Mesh" [7563-8366] -->
<h2><a>See also</a></h2>
<h2><a>See also</a></h2>
<div>
<div>
<ul>
<p>
<li><div><ahref="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a> – The GeometryBatchFactory class batches several Geometries into meshes with each their own texture.</div>
</li>
* <ahref="/com/jme3/gde/core/docs/jme3/intermediate/optimization.html">Optimization</a> – The GeometryBatchFactory class batches several Geometries into meshes with each their own texture.
<li><div><ahref="/com/jme3/gde/core/docs/jme3/advanced/traverse_scenegraph.html">Traverse SceneGraph</a> – Find any Node or Geometry in the scenegraph.</div>
@ -226,10 +226,12 @@ Activating the nbandroid plugin in the jMonkeyEngine <acronym title="Software De
</li>
</li>
<li><div> To sign your application, edit the mobile/build.properties file to point at valid keystore files.</div>
<li><div> To sign your application, edit the mobile/build.properties file to point at valid keystore files.</div>
</li>
</li>
<li><div> If you get a FileNotFoundException for MANIFEST.FM when compiling with Android <acronymtitle="Software Development Kit">SDK</acronym> Rev. 20 you need to copy and paste mobile/AndroidManifest.xml to mobile/MANIFEST.MF (<objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/groups/android/forum/topic/issues-building-with-android-sdk-rev-20/"><paramname="text"value="<html><u>http://jmonkeyengine.org/groups/android/forum/topic/issues-building-with-android-sdk-rev-20/</u></html>"><paramname="textColor"value="blue"></object>)</div>
@ -119,16 +119,12 @@ When you run the sample, you should see a blue cube. You should hear a nature-li
In the <code>initSimpleApp()</code> method, you create a simple blue cube geometry called <code>player</code> and attach it to the scene – this just arbitrary sample content, so you see something when running the audio sample.
In the <code>initSimpleApp()</code> method, you create a simple blue cube geometry called <code>player</code> and attach it to the scene – this just arbitrary sample content, so you see something when running the audio sample.
</p>
</p>
<p>
From <code>initSampleApp()</code>, you initialize the game by calling the two custom methods <code>initKeys()</code> and <code>initAudio()</code>. You could call the lines of code in these two methods directly from <code>initSampleApp()</code>; they merely are in extra methods to keep the code more readable.
</p>
<p>
<p>
Let's have a closer look at <code>initAudio()</code> to learn how to use <code>AudioNode</code>s.
Let's have a closer look at <code>initAudio()</code> to learn how to use <code>AudioNode</code>s.
</p>
</p>
</div>
</div>
<!-- EDIT3 SECTION "Understanding the Code Sample" [3517-4126] -->
<!-- EDIT3 SECTION "Understanding the Code Sample" [3517-3851] -->
<h2><a>AudioNodes</a></h2>
<h2><a>AudioNodes</a></h2>
<div>
<div>
@ -184,7 +180,7 @@ Here you make audio_nature a positional sound that comes from a certain place. F
</p>
</p>
</div>
</div>
<!-- EDIT4 SECTION "AudioNodes" [4127-6788] -->
<!-- EDIT4 SECTION "AudioNodes" [3852-6513] -->
<h2><a>Triggering Sound</a></h2>
<h2><a>Triggering Sound</a></h2>
<div>
<div>
@ -216,7 +212,7 @@ Since you want to be able to shoot fast repeatedly, so you do not want to wait f
@ -259,15 +259,16 @@ You can also combine both listeners into one, the engine will send the appropria
}
}
}
}
// ...
// ...
inputManager.addListener(analogListener, new String[]{"Pause", "Left", "Right", "Rotate"});
inputManager.addListener(combinedListener, new String[]{"Pause", "Left", "Right", "Rotate"});
</pre>
</pre>
<p>
<p>
It's okay to use only one of the two Listeners, and not implement the other one, if you are not using this type of interaction. In the following, we have a closer look how to decide which of the two listeners is best suited for which situation.
It's okay to use only one of the two Listeners, and not implement the other one, if you are not using this type of interaction. In the following, we have a closer look how to decide which of the two listeners is best suited for which situation.
</p>
</p>
</div>
</div>
<!-- EDIT4 SECTION "Implementing the Actions" [5894-9011] -->
<!-- EDIT4 SECTION "Implementing the Actions" [5894-9012] -->
<h2><a>Analog, Pressed, or Released?</a></h2>
<h2><a>Analog, Pressed, or Released?</a></h2>
<div>
<div>
@ -324,7 +325,7 @@ Mappings registered to the <strong>ActionListener</strong> are digital either-or
}</pre>
}</pre>
</div>
</div>
<!-- EDIT5 SECTION "Analog, Pressed, or Released?" [9012-11037] -->
<!-- EDIT5 SECTION "Analog, Pressed, or Released?" [9013-11038] -->
<h2><a>Table of Triggers</a></h2>
<h2><a>Table of Triggers</a></h2>
<div>
<div>
@ -360,14 +361,14 @@ You can find the list of input constants in the files <code>src/core/com/jme3/in
<strong>Tip:</strong> If you don't recall an input constant during development, you benefit from an IDE's code completion functionality: Place the caret after e.g. <code>KeyInput.|</code> and trigger code completion to select possible input identifiers.
<strong>Tip:</strong> If you don't recall an input constant during development, you benefit from an IDE's code completion functionality: Place the caret after e.g. <code>KeyInput.|</code> and trigger code completion to select possible input identifiers.
</p>
</p>
</div>
</div>
<!-- EDIT6 SECTION "Table of Triggers" [11038-12100] -->
<!-- EDIT6 SECTION "Table of Triggers" [11039-12101] -->
<h2><a>Exercises</a></h2>
<h2><a>Exercises</a></h2>
<div>
<div>
<ol>
<ol>
@ -395,7 +396,7 @@ inputManager.addMapping("Pause", new KeyTrigger(usersPauseKey
</p>
</p>
</div>
</div>
<!-- EDIT8 SECTION "Exercises" [12101-12785] -->
<!-- EDIT8 SECTION "Exercises" [12102-12786] -->
<h2><a>Conclusion</a></h2>
<h2><a>Conclusion</a></h2>
<div>
<div>
@ -417,5 +418,5 @@ Now you can already write a little interactive game! But wouldn't it be coo
/** Create a pivot node at (0,0,0) and attach it to the root node */
/** Create a pivot node at (0,0,0) and attach it to the root node */
Node pivot = new Node("pivot");
Node pivot = new Node("pivot");
@ -97,7 +99,7 @@ Build and run the code sample. You should see two colored boxes tilted at the sa
</p>
</p>
</div>
</div>
<!-- EDIT2 SECTION "Code Sample" [997-3001] -->
<!-- EDIT2 SECTION "Code Sample" [997-3048] -->
<h2><a>Understanding the Terminology</a></h2>
<h2><a>Understanding the Terminology</a></h2>
<div>
<div>
@ -123,10 +125,10 @@ In this tutorial, you learn some new terms:
<td>Make an object disappear from the scene</td><td>Detach the Spatial from the rootNode</td>
<td>Make an object disappear from the scene</td><td>Detach the Spatial from the rootNode</td>
</tr>
</tr>
<tr>
<tr>
<td>Position/move, turn, or resize an object</td><td>Translate, rotate, scale an object. Transform an object.</td>
<td>Position/move, turn, or resize an object</td><td>Translate, or rotate, or scale an object = transform an object.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT4 TABLE [3090-3507] -->
<!-- EDIT4 TABLE [3137-3561] -->
<p>
<p>
Every JME3 application has a rootNode: Your game automatically inherits the <code>rootNode</code> object from SimpleApplication. Everything attached to the rootNode is part of the scene graph. The elements of the scene graph are Spatials.
Every JME3 application has a rootNode: Your game automatically inherits the <code>rootNode</code> object from SimpleApplication. Everything attached to the rootNode is part of the scene graph. The elements of the scene graph are Spatials.
@ -153,9 +155,9 @@ Every JME3 application has a rootNode: Your game automatically inherits the <cod
<th> Examples: </th><td> A box, a sphere, a player, a building, a piece of terrain, a vehicle, missiles, NPCs, etc… </td><td> The <code>rootNode</code>, a floor node grouping several terrains, a custom vehicle-with-passengers node, a player-with-weapon node, an audio node, etc… </td>
<th> Examples: </th><td> A box, a sphere, a player, a building, a piece of terrain, a vehicle, missiles, NPCs, etc… </td><td> The <code>rootNode</code>, a floor node grouping several terrains, a custom vehicle-with-passengers node, a player-with-weapon node, an audio node, etc… </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT5 TABLE [3923-4416] -->
<!-- EDIT5 TABLE [3977-4470] -->
</div>
</div>
<!-- EDIT3 SECTION "Understanding the Terminology" [3002-4417] -->
<!-- EDIT3 SECTION "Understanding the Terminology" [3049-4471] -->
<h2><a>Understanding the Code</a></h2>
<h2><a>Understanding the Code</a></h2>
<div>
<div>
@ -169,18 +171,19 @@ What happens in the code snippet? You use the <code>simpleInitApp()</code> metho
<ul>
<ul>
<li><div> Create a Box shape with a radius of (1,1,1), that makes the box 2x2x2 world units big.</div>
<li><div> Create a Box shape with a radius of (1,1,1), that makes the box 2x2x2 world units big.</div>
</li>
</li>
<li><div> Position the box at (1,-1,1).</div>
<li><div> Position the box at (1,-1,1) using the move() method. (Don't change the Vector3f.ZERO unless you want to change the center of rotation)</div>
</li>
</li>
<li><div> Wrap the Box shape into a Geometry.</div>
<li><div> Wrap the Box shape into a Geometry.</div>
</li>
</li>
<li><div> Create a blue material. </div>
<li><div> Create a blue material. </div>
</li>
</li>
<li><div> Apply the blue material to the Box Geometry. <pre> Box box1 = new Box(new Vector3f(1,-1,1), 1,1,1);
<li><div> Apply the blue material to the Box Geometry. <pre> Box box1 = new Box(Vector3f.ZERO, 1,1,1);
Geometry blue = new Geometry("Box", box1);
Geometry blue = new Geometry("Box", box1);
@ -241,7 +245,7 @@ If you run the app with only the code up to here, you see two cubes: A red cube
</ol>
</ol>
</div>
</div>
<!-- EDIT6 SECTION "Understanding the Code" [4418-6684] -->
<!-- EDIT6 SECTION "Understanding the Code" [4472-6875] -->
<h3><a>What is a Pivot Node?</a></h3>
<h3><a>What is a Pivot Node?</a></h3>
<div>
<div>
@ -260,7 +264,7 @@ You can transform (e.g. rotate) Geometries around their own center, or around a
</ul>
</ul>
</div>
</div>
<!-- EDIT7 SECTION "What is a Pivot Node?" [6685-8005] -->
<!-- EDIT7 SECTION "What is a Pivot Node?" [6876-8196] -->
<h2><a>How do I Populate the Scenegraph?</a></h2>
<h2><a>How do I Populate the Scenegraph?</a></h2>
<div>
<div>
<div><table>
<div><table>
@ -268,8 +272,8 @@ You can transform (e.g. rotate) Geometries around their own center, or around a
<th> Task…? </th><th> Solution! </th>
<th> Task…? </th><th> Solution! </th>
</tr>
</tr>
<tr>
<tr>
<td> Create a Spatial </td><td> Create a shape, wrap it into a Geometry, and give it a Material. For example: <pre>Box mesh = new Box(Vector3f.ZERO, 1, 1, 1);
<td> Create a Spatial </td><td> Create a Mesh shape, wrap it into a Geometry, and give it a Material. For example: <pre>Box mesh = new Box(Vector3f.ZERO, 1, 1, 1); // a cuboid default mesh
Geometry thing = new Geometry("thing", mesh);
Geometry thing = new Geometry("thing", mesh);
<td> Specify what should be loaded at the start </td><td> Everything you initialize and attach to the <code>rootNode</code> in the <code>simpleInitApp()</code> method is part of the scene at the start of the game. </td>
<td> Specify what should be loaded at the start </td><td> Everything you initialize and attach to the <code>rootNode</code> in the <code>simpleInitApp()</code> method is part of the scene at the start of the game. </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT9 TABLE [8053-9315] -->
<!-- EDIT9 TABLE [8244-9537] -->
</div>
</div>
<!-- EDIT8 SECTION "How do I Populate the Scenegraph?" [8006-9316] -->
<!-- EDIT8 SECTION "How do I Populate the Scenegraph?" [8197-9538] -->
<h2><a>How do I Transform Spatials?</a></h2>
<h2><a>How do I Transform Spatials?</a></h2>
<div>
<div>
@ -320,7 +324,7 @@ To move a Spatial <em>to</em> specific coordinates, such as (0,40.2f,-2), use: <
<td>3-D rotation is a bit tricky (<ahref="/com/jme3/gde/core/docs/jme2/rotate.html">learn details here</a>). In short: You can rotate around three axes: Pitch, yaw, and roll. You can specify angles in degrees by multiplying the degrees value with <code>FastMath.DEG_TO_RAD</code>. <br/>
<td>3-D rotation is a bit tricky (<ahref="/com/jme3/gde/core/docs/jme3/rotate.html">learn details here</a>). In short: You can rotate around three axes: Pitch, yaw, and roll. You can specify angles in degrees by multiplying the degrees value with <code>FastMath.DEG_TO_RAD</code>. <br/>
To roll an object 180° around the z axis: <pre>thing.rotate( 0f , 0f , 180*FastMath.DEG_TO_RAD );</pre>
To roll an object 180° around the z axis: <pre>thing.rotate( 0f , 0f , 180*FastMath.DEG_TO_RAD );</pre>
<p>
<p>
Tip: If your game idea calls for a serious amount of rotations, it is worth looking into <ahref="/com/jme3/gde/core/docs/jme2/quaternion.html">quaternion</a>s, a data structure that can combine and store rotations efficiently.
Tip: If your game idea calls for a serious amount of rotations, it is worth looking into <ahref="/com/jme3/gde/core/docs/jme3/quaternion.html">quaternion</a>s, a data structure that can combine and store rotations efficiently.
</p>
</p>
<pre>thing.setLocalRotation(
<pre>thing.setLocalRotation(
new Quaternion().fromAngleAxis(180*FastMath.DEG_TO_RAD, new Vector3f(1,0,0)));</pre>
new Quaternion().fromAngleAxis(180*FastMath.DEG_TO_RAD, new Vector3f(1,0,0)));</pre>
</td><td>pitch = nodding your head</td><td>yaw = shaking your head</td><td>roll = cocking your head</td>
</td><td>pitch = nodding your head</td><td>yaw = shaking your head</td><td>roll = cocking your head</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT13 TABLE [10449-11230] -->
<!-- EDIT13 TABLE [10671-11452] -->
</div>
</div>
<!-- EDIT10 SECTION "How do I Transform Spatials?" [9317-11231] -->
<!-- EDIT10 SECTION "How do I Transform Spatials?" [9539-11453] -->
<h2><a>How do I Troubleshoot Spatials?</a></h2>
<h2><a>How do I Troubleshoot Spatials?</a></h2>
<div>
<div>
@ -371,17 +375,18 @@ Is it to tiny or too gigantic to see? <br/>
Is it too far from the camera? (Try <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/javadoc/com/jme3/renderer/Camera.html#setFrustumFar%28float%29"><paramname="text"value="<html><u>cam.setFrustumFar</u></html>"><paramname="textColor"value="blue"></object>(111111f); to see further) </td>
Is it too far from the camera? (Try <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://jmonkeyengine.org/javadoc/com/jme3/renderer/Camera.html#setFrustumFar%28float%29"><paramname="text"value="<html><u>cam.setFrustumFar</u></html>"><paramname="textColor"value="blue"></object>(111111f); to see further) </td>
</tr>
</tr>
<tr>
<tr>
<td> A Spatial rotates in unexpected ways. </td><td> Did you use radian values, and not degrees? (If you used degrees, multiply them with FastMath.DEG_TO_RAD to convert them to radians)<br/>
<td> A Spatial rotates in unexpected ways. </td><td> Did you use radian values, and not degrees? (If you used degrees, multiply them with FastMath.DEG_TO_RAD to convert them to radians) <br/>
Did you rotate around the intended pivot node or something else? <br/>
Did you create the Spatial at the origin (Vector.ZERO) before moving it? <br/>
Did you rotate around the intended pivot node or around something else? <br/>
Did you rotate around the right axis? </td>
Did you rotate around the right axis? </td>
</tr>
</tr>
<tr>
<tr>
<td> A Geometry has an unexpected Color or Material. </td><td> Did you reuse a Material from another Geometry and have inadvertently changed its properties? (If so, consider cloning it: mat2 = mat.clone(); ) </td>
<td> A Geometry has an unexpected Color or Material. </td><td> Did you reuse a Material from another Geometry and have inadvertently changed its properties? (If so, consider cloning it: mat2 = mat.clone(); ) </td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT15 TABLE [11363-12336] -->
<!-- EDIT15 TABLE [11585-12643] -->
</div>
</div>
<!-- EDIT14 SECTION "How do I Troubleshoot Spatials?" [11232-12337] -->
<!-- EDIT14 SECTION "How do I Troubleshoot Spatials?" [11454-12644] -->
<h2><a>How do I Add Custom Data to Spatials?</a></h2>
<h2><a>How do I Add Custom Data to Spatials?</a></h2>
<div>
<div>
@ -414,7 +419,7 @@ By using different Strings keys (here the key is <code>pivot id</code>), you can
</p>
</p>
</div>
</div>
<!-- EDIT16 SECTION "How do I Add Custom Data to Spatials?" [12338-13703] -->
<!-- EDIT16 SECTION "How do I Add Custom Data to Spatials?" [12645-14010] -->
<h2><a>Conclusion</a></h2>
<h2><a>Conclusion</a></h2>
<div>
<div>
@ -432,9 +437,13 @@ Since standard shapes like spheres and boxes get old fast, continue with the nex
@ -59,7 +59,7 @@ To export an animated model in Blender make sure the following conditions are me
</p>
</p>
<ol>
<ol>
<li><div> The animation bas to be a <strong>bone animation</strong></div>
<li><div> The animation has to be a <strong>bone animation</strong></div>
</li>
</li>
<li><div> Apply Location, Rotation and Scate to the mesh on Blender: On 3D View editor on Blender, select the mesh in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Scale.</div>
<li><div> Apply Location, Rotation and Scate to the mesh on Blender: On 3D View editor on Blender, select the mesh in Object Mode and go to the 3D View Editor’s header → Object Menu → Apply → Location / Rotation / Scale.</div>
@ -99,11 +99,23 @@ Make sure to only load() models converted to .j3o binary format, not the origina
</div>
</div>
<!-- EDIT9 SECTION "Why does the executable crash with Cannot locate resource?" [2661-2991] -->
<!-- EDIT9 SECTION "Why does the executable crash with Cannot locate resource?" [2661-2991] -->
<h3><a>What is java.lang.LinkageError: Version mismatch?</a></h3>
<div>
<p>
This rare exception shows a message similar to the following: <code>Exception in thread "LWJGL Renderer Thread" java.lang.LinkageError: Version mismatch: jar version is (number), native library version is (another number)</code>. jME3 needs native libraries (.dll, .jnilib, lib*.so files) to run LWJGL and jBullet. The correct versions of these libraries are included when you install the <acronymtitle="Software Development Kit">SDK</acronym> or download the binaries. However there are circumstances where jME3 cannot determine which copy of the native library it should use: <br/>
If you install another application that needs a different version of a native library, and this app globally installs its version over jME3's; or if an old copy of a native library is in your project directory, your home directory, or Java library path, or in the classpath; or if you permanently linked an old copy in your IDE's settings; then Java assumes you prefer these native libraries over the bundled ones, and your jME3 application ends up running with the wrong version. <br/>
To fix this, search for .dll (Windows), .jnilib (Mac), and .so (Linux) files for jBullet and LWJGL on your harddrive and in your path and IDE settings, and verify they don't interfere. (If you have other jME versions installed and linked somehow, the outdated natives may also be in a lwjgl.jar or jbullet.jar file!)
</p>
</div>
<!-- EDIT10 SECTION "What is java.lang.LinkageError: Version mismatch?" [2992-4375] -->
<h2><a>I want to load my scene</a></h2>
<h2><a>I want to load my scene</a></h2>
<div>
<div>
</div>
</div>
<!-- EDIT10 SECTION "I want to load my scene" [2992-3027] -->
<!-- EDIT11 SECTION "I want to load my scene" [4376-4411] -->
<h3><a>How do I make objects appear / disappear in the 3D scene?</a></h3>
<h3><a>How do I make objects appear / disappear in the 3D scene?</a></h3>
<div>
<div>
@ -128,7 +140,7 @@ Optionally, you can control whether the engine culls an object always or never.
</p>
</p>
</div>
</div>
<!-- EDIT11 SECTION "How do I make objects appear / disappear in the 3D scene?" [3028-3937] -->
<!-- EDIT12 SECTION "How do I make objects appear / disappear in the 3D scene?" [4412-5321] -->
<h3><a>Why do I get AssetNotFoundException when loading X ?</a></h3>
<h3><a>Why do I get AssetNotFoundException when loading X ?</a></h3>
Follow our best practices for the <ahref="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">multi-media asset pipeline</a>. <br/>
Follow our best practices for the <ahref="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">multi-media asset pipeline</a>. <br/>
You create 3-D models in a 3-D mesh editor, for example Blender, and export it in Ogre Mesh <acronymtitle="Extensible Markup Language">XML</acronym> (animated objects, scenes) or Wavefront OBJ format (static objects, scenes).
You create 3-D models in a 3-D mesh editor, for example Blender, and export it in Ogre Mesh <acronymtitle="Extensible Markup Language">XML</acronym> (animated objects, scenes) or Wavefront OBJ format (static objects, scenes).
You create textures in a graphic editor, for exmaple Gimp, and export them as <acronymtitle="Portable Network Graphics">PNG</acronym> or <acronymtitle="Joint Photographics Experts Group">JPG</acronym>.
You create textures in a graphic editor, for example Gimp, and export them as <acronymtitle="Portable Network Graphics">PNG</acronym> or <acronymtitle="Joint Photographics Experts Group">JPG</acronym>.
You create sounds in an audio editor, for example, Audacity, and export them as WAVE or OGG.
You create sounds in an audio editor, for example, Audacity, and export them as WAVE or OGG.
@ -144,7 +144,7 @@ How you name or number these stages is fully up to your team. Development teams
</p>
</p>
</div>
</div>
<!-- EDIT4 SECTION "Planning Development Milestones" [2001-3785] -->
<!-- EDIT4 SECTION "Planning Development Milestones" [2014-3798] -->
<h3><a>Use File Version Control</a></h3>
<h3><a>Use File Version Control</a></h3>
<div>
<div>
@ -163,7 +163,7 @@ If you don't know which to choose, Subversion is a good choice for starters
</ul>
</ul>
</div>
</div>
<!-- EDIT5 SECTION "Use File Version Control" [3786-4618] -->
<!-- EDIT5 SECTION "Use File Version Control" [3799-4631] -->
<h2><a>Multi-Media Asset Pipeline</a></h2>
<h2><a>Multi-Media Asset Pipeline</a></h2>
<div>
<div>
<div><table>
<div><table>
@ -189,14 +189,14 @@ If you don't know which to choose, Subversion is a good choice for starters
<td> Convert Models to j3o format. Move j3o files into <code>assets/Models</code>. </td><td>Don't reference Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the JAR.</td>
<td> Convert Models to j3o format. Move j3o files into <code>assets/Models</code>. </td><td>Don't reference Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the JAR.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT7 TABLE [4659-5545] -->
<!-- EDIT7 TABLE [4672-5558] -->
<p>
<p>
Learn details about the <ahref="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a> here.
Learn details about the <ahref="/com/jme3/gde/core/docs/jme3/intermediate/multi-media_asset_pipeline.html">Multi-Media Asset Pipeline</a> here.
@ -507,7 +507,7 @@ Decide whether you want to release your game as WebStart, desktop JAR, mobile AP
(.APK)</td><td>Game runs on Android devices.</td><td>Android devices do not support post-procesor effects.</td>
(.APK)</td><td>Game runs on Android devices.</td><td>Android devices do not support post-procesor effects.</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT21 TABLE [19751-20971] -->
<!-- EDIT21 TABLE [19764-20984] -->
<p>
<p>
Which ever method you choose, a Java-Application works on the main operating systems: Windows, Mac <acronymtitle="Operating System">OS</acronym>, Linux, Android.
Which ever method you choose, a Java-Application works on the main operating systems: Windows, Mac <acronymtitle="Operating System">OS</acronym>, Linux, Android.
@ -519,5 +519,5 @@ The distribution appears in a newly generated <code>dist</code> directory inside
</p>
</p>
</div>
</div>
<!-- EDIT20 SECTION "Distributing the Executables" [19298-] -->
<!-- EDIT20 SECTION "Distributing the Executables" [19311-] -->
@ -193,7 +193,7 @@ Shininess is a float value between 1 (rough surface with blurry shininess) and 1
</div>
</div>
</li>
</li>
<li><div> Specify the <code>Specular</code> and <code>Diffuse</code> colors of the shiny spot. <br/>
<li><div> Specify the <code>Specular</code> and <code>Diffuse</code> colors of the shiny spot. <br/>
The ColorRGBA value of the light source, often RGBA.White.<pre>mat.setColor("Specular",ColorRGBA.White);
Typically you set Specular to the ColorRGBA value of the light source, often RGBA.White.<pre>mat.setColor("Specular",ColorRGBA.White);
@ -208,13 +208,13 @@ You optionally hand-draw this grayscale texture to outline in detail where the s
To deactivate shininess
To deactivate shininess
</p>
</p>
<ul>
<ul>
<li><div> Set the <code>Specular</code> color to <code>ColorRGBA.Black</code>. Do not just set <code>Shininess</code> to 0.<pre>mat.setFloat("Shininess", 0f);</pre>
<li><div> Set the <code>Specular</code> color to <code>ColorRGBA.Black</code>. Do not just set <code>Shininess</code> to 0.<pre>mat.setColor("Specular",ColorRGBA.Black);</pre>
@ -356,7 +356,7 @@ Additionally to the above settings, you can switch off and on a wireframe render
<td>getAdditionalRenderState().setWireframe(true);</td><td>Switch to showing the (textured) Material in wireframe mode. The wireframe optionally uses the Material's <code>Color</code> value.</td><td>Use wireframes to debug meshes, or for a "matrix" or "holodeck" effect.</td>
<td>getAdditionalRenderState().setWireframe(true);</td><td>Switch to showing the (textured) Material in wireframe mode. The wireframe optionally uses the Material's <code>Color</code> value.</td><td>Use wireframes to debug meshes, or for a "matrix" or "holodeck" effect.</td>
@ -26,26 +26,26 @@ Assets are files that are not code. Your multi-media assets includes, for exampl
<td> Save sounds into <code>assets/Sounds</code>. </td><td> Don't leave audio files in a folder outside your JME project: The game cannot load or reference them from there. </td>
<td> Save sounds into <code>assets/Sounds</code>. </td><td> Don't leave audio files in a folder outside your JME project: The game cannot load or reference them from there. </td>
</tr>
</tr>
<tr>
<tr>
<td> Create simple, low-polygon models. </td><td> Don't create high-polygon models, they render too slow to be useful in games. </td>
<td> Create low-polygon models. </td><td> Don't create high-polygon models, they render too slow to be useful in games. </td>
</tr>
</tr>
<tr>
<tr>
<td> Only use Diffuse Map, Normal Map, Glow Map, Specular Map in your models. </td><td> Don't use unsupported material properties that are not listed in the <ahref="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>.</td>
<td> Only use Diffuse Map, Normal Map, Glow Map, Specular Map in your models' materials. </td><td> Don't use unsupported material properties that are not listed in the <ahref="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a>.</td>
</tr>
</tr>
<tr>
<tr>
<td> Use UV texture / texture atlases / baking for each texture map. </td><td> Don't create models based on multiple separate textures, it will break the model into separate meshes.</td>
<td> Use UV texture / texture atlases / baking for each texture map. </td><td> Don't create models based on multiple separate textures, it will break the model into separate meshes.</td>
</tr>
</tr>
<tr>
<tr>
<td> Convert original models to .j3o format. Move .j3o files into <code>assets/Models</code>. </td><td>Don't reference original Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not packaged into the final JAR.</td>
<td> Convert original models to JME3's .j3o format. Move .j3o files into <code>assets/Models</code>. </td><td>Don't reference original Blender/Ogre/OBJ files in your load() code, because these unoptimized files are not automatically packaged into the final JAR.</td>
<!-- EDIT3 SECTION "Use The Assets Folder" [1617-3506] -->
<!-- EDIT3 SECTION "Use The Assets Folder" [1641-3530] -->
<h3><a>Create Textures and Materials</a></h3>
<h3><a>Create Textures and Materials</a></h3>
<div>
<div>
@ -128,12 +128,13 @@ Install a graphic editor such as Gimp or Photoshop. <strong>Consult the graphic
<p>
<p>
<p><div>Storing the textures inside your project directory is necessary for the paths in JME's binary model files (.j3o) to work. Treat the paths of your assets like class names of java classes, they define a specific asset. When you later generate .j3o files, compile class files, and distribute the project, paths and files need to be available in their final absolute form. It is imperative to keep the same directory structure from beginning to end. If you ever change the assets directory structure, you have to re-export all affected models, regenerate all affected .j3o files, and manually update all affected paths in your code.
<p><div>Storing the textures inside your project directory is necessary for the paths in JME's binary model files (.j3o) to work. Treat the paths of your assets like class names of java classes, they define a specific asset. When you later generate .j3o files, compile class files, and distribute the project, paths and files need to be available in their final absolute form. It is imperative to keep the same directory structure from beginning to end. <br/>
If you ever change the assets directory structure, you will have to do manual refactoring (just as for Java package name changes): You will need to re-export all affected models, regenerate all affected .j3o files, and manually update all affected paths in your code.
</div></p>
</div></p>
</p>
</p>
</div>
</div>
<!-- EDIT4 SECTION "Create Textures and Materials" [3507-4681] -->
<!-- EDIT4 SECTION "Create Textures and Materials" [3531-4793] -->
<h3><a>Create 3D Models</a></h3>
<h3><a>Create 3D Models</a></h3>
<div>
<div>
@ -145,13 +146,13 @@ Install a mesh editor such as <a href="/com/jme3/gde/core/docs/jme3/external/ble
<ol>
<ol>
<li><div> Create 3D models in a mesh editor. </div>
<li><div> Create 3D models in a mesh editor. </div>
<ol>
<ol>
<li><div> Create simple <strong>low-polygon models</strong>. High-polygon models slow down the game.</div>
<li><div> Create simple <strong>low-polygon models</strong>. High-polygon models may look pretty in static 3D art contests, but they unnecessarily slow down dynamic games.</div>
</li>
</li>
<li><div>Unwrap the model and generate a <strong>UV texture</strong> (i.e. one texture file that contains all the pieces of one model from different angles).<br/>
<li><div>Create materials for your models either in the 3D editor, or in the jME3 <acronymtitle="Software Development Kit">SDK</acronym>. Only use <strong>Diffuse Map (minimum), Normal Map, Glow Map, and Specular Map.</strong><br/>
Don't use multiple separate texture files with one model, it will break the model into several meshes.</div>
Every material feature not listed in the <ahref="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> is unsupported and ignored by JME3.</div>
</li>
</li>
<li><div>Create textures for the model: Only use<strong>Diffuse Map (minimum), Normal Map, Glow Map, and Specular Map.</strong><br/>
<li><div>Unwrap the model in the 3D editor and generate a<strong>UV texture</strong> (i.e. one texture file that contains all the pieces of one model from different angles).<br/>
Everything not listed in the <ahref="/com/jme3/gde/core/docs/jme3/advanced/materials_overview.html">Materials Overview</a> is ignored by JME.</div>
Don't use multiple separate texture files with one model, it will break the model into several meshes.</div>
</li>
</li>
</ol>
</ol>
</li>
</li>
@ -177,7 +178,7 @@ See also: <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer">
</p>
</p>
</div>
</div>
<!-- EDIT5 SECTION "Create 3D Models" [4682-6478] -->
<!-- EDIT5 SECTION "Create 3D Models" [4794-6754] -->
<h3><a>Convert 3D Models to .j3o Format</a></h3>
<h3><a>Convert 3D Models to .j3o Format</a></h3>
<div>
<div>
@ -226,11 +227,25 @@ Use the jMonkeyEngine SceneComposer to add these properties.</div>
</div></p>
</div></p>
</p>
</p>
<p>
</div>
See also: <ahref="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a>
<!-- EDIT6 SECTION "Convert 3D Models to .j3o Format" [6755-8816] -->
<h2><a>See Also</a></h2>
</p>
<div>
<ul>
<li><div><ahref="/com/jme3/gde/core/docs/jme3/advanced/save_and_load.html">Save and Load</a></div>
</li>
<li><div><ahref="/com/jme3/gde/core/docs/sdk/model_loader_and_viewer.html">Model Loader and Viewer</a></div>
It's a fact of life, math is hard. Unfortunately, 3D graphics require a fair bit of knowledge about the subject. Fortunately, jME is able to hide the majority of the details away from the user. Vectors are the fundamental type in the 3D environment, and it is used extensively. Matrices are also a basic necessity of 3D for representing linear systems. Quaternions are perhaps the most complicated of the basic types and are used for rotation in jME.
It's a fact of life, math is hard. Unfortunately, 3D graphics require a fair bit of knowledge about the subject. Fortunately, jME is able to hide the majority of the details away from the user. Vectors are the fundamental type in the 3D environment, and it is used extensively. Matrices are also a basic necessity of 3D for representing linear systems. <ahref="/com/jme3/gde/core/docs/jme3/quaternion.html">Quaternion</a>s are perhaps the most powerful and complicated of the basic types and are used for rotation in jME.
</p>
</p>
<p>
<p>
@ -16,12 +16,12 @@ To get a visual introduction to math in jME3 for the absolute beginner, check ou
</p>
</p>
</div>
</div>
<!-- EDIT1 SECTION "Introduction to Mathematical Functionality" [1-944] -->
<!-- EDIT1 SECTION "Introduction to Mathematical Functionality" [1-961] -->
@ -87,7 +87,7 @@ ColorRGBA defines a color value in the jME library. The color value is made of t
</p>
</p>
</div>
</div>
<!-- EDIT8 SECTION "Definition" [3010-3481] -->
<!-- EDIT8 SECTION "Definition" [3027-3498] -->
<h3><a>jME Class</a></h3>
<h3><a>jME Class</a></h3>
<div>
<div>
@ -109,25 +109,25 @@ ColorRGBA will also handle interpolation between two colors. Given a second colo
</p>
</p>
</div>
</div>
<!-- EDIT9 SECTION "jME Class" [3482-3956] -->
<!-- EDIT9 SECTION "jME Class" [3499-3973] -->
<h2><a>Matrix</a></h2>
<h2><a>Matrix</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix3f.html"><paramname="text"value="<html><u>Javadoc of Matrix3f</u></html>"><paramname="textColor"value="blue"></object><br/>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix3f.html"><paramname="text"value="<html><u>Matrix3f Javadoc</u></html>"><paramname="textColor"value="blue"></object><br/>
and <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix4f.html"><paramname="text"value="<html><u>Javadoc of Matrix4f</u></html>"><paramname="textColor"value="blue"></object>
and <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Matrix4f.html"><paramname="text"value="<html><u>Matrix4f Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT10 SECTION "Matrix" [3957-4153] -->
<!-- EDIT10 SECTION "Matrix" [3974-4164] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
<p>
<p>
A Matrix is typically used as a <em>linear transformation</em> to map vectors to vectors. That is: Y = MX where X is a Vector and M is a Matrix applying any or all transformations (scale, rotate, translate).
A Matrix is typically used as a <em>linear transformation</em> to map vectors to vectors. That is: Y = MX where X is a Vector and M is a Matrix applying any or all transformations (scale, <ahref="/com/jme3/gde/core/docs/jme3/rotate.html">rotate</a>, translate).
</p>
</p>
<p>
<p>
@ -148,7 +148,7 @@ There are a few special matrices:
<td>0</td><td>0</td><td>0</td>
<td>0</td><td>0</td><td>0</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT12 TABLE [4469-4492] -->
<!-- EDIT12 TABLE [4484-4507] -->
<p>
<p>
The <em>Identity Matrix</em> is the matrix with 1 on the diagonal entries and 0 for all other entries.
The <em>Identity Matrix</em> is the matrix with 1 on the diagonal entries and 0 for all other entries.
@ -164,7 +164,7 @@ The <em>Identity Matrix</em> is the matrix with 1 on the diagonal entries and 0
<td>0</td><td>0</td><td>1</td>
<td>0</td><td>0</td><td>1</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT13 TABLE [4593-4616] -->
<!-- EDIT13 TABLE [4608-4631] -->
<p>
<p>
A Matrix is <em>invertible</em> if there is a matrix <em>M<sup>-1</sup></em> where <em>MM<sup>-1</sup> = M<sup>-1</sup>M = I</em>.
A Matrix is <em>invertible</em> if there is a matrix <em>M<sup>-1</sup></em> where <em>MM<sup>-1</sup> = M<sup>-1</sup>M = I</em>.
@ -185,7 +185,7 @@ The <em>transpose</em> of a matrix <em>M = [m<sub>ij</sub>]</em> is <em>M<sup>T<
@ -270,14 +270,14 @@ Translation requires a 4x4 matrix, where the vector (x,y,z) is mapped to (x,y,z,
<td>S<sup>T</sup></td><td>1</td>
<td>S<sup>T</sup></td><td>1</td>
</tr>
</tr>
</table></div>
</table></div>
<!-- EDIT18 TABLE [6277-6300] -->
<!-- EDIT18 TABLE [6292-6315] -->
<p>
<p>
where M is the 3x3 matrix (containing any rotation/scale information), T is the translation vector and S<sup>T</sup> is the transpose Vector of T. 1 is just a constant.
where M is the 3x3 matrix (containing any rotation/scale information), T is the translation vector and S<sup>T</sup> is the transpose Vector of T. 1 is just a constant.
@ -291,19 +291,19 @@ Most methods are straight forward, and I will leave documentation to the Javadoc
</p>
</p>
</div>
</div>
<!-- EDIT19 SECTION "jME Class" [6473-6715] -->
<!-- EDIT19 SECTION "jME Class" [6488-6730] -->
<h2><a>Vector</a></h2>
<h2><a>Vector</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Vector3f.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object><br/>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Vector3f.html"><paramname="text"value="<html><u>Vector3f Javadoc</u></html>"><paramname="textColor"value="blue"></object><br/>
and <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Vector2f.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
and <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Vector2f.html"><paramname="text"value="<html><u>Vector2f Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT20 SECTION "Vector" [6716-6888] -->
<!-- EDIT20 SECTION "Vector" [6731-6921] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -321,7 +321,7 @@ We have two Vectors (2f and 3f) meaning we have tuples of 2 float values or 3 fl
</p>
</p>
</div>
</div>
<!-- EDIT21 SECTION "Definition" [6889-7313] -->
<!-- EDIT21 SECTION "Definition" [6922-7346] -->
<h3><a>Operations</a></h3>
<h3><a>Operations</a></h3>
<div>
<div>
@ -411,17 +411,17 @@ Vector3f and Vector2f store their values (x, y, z) and (x, y) respectively as fl
</p>
</p>
</div>
</div>
<!-- EDIT22 SECTION "Operations" [7314-9249] -->
<!-- EDIT22 SECTION "Operations" [7347-9282] -->
<h2><a>Quaternion</a></h2>
<h2><a>Quaternion</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Quaternion.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Quaternion.html"><paramname="text"value="<html><u>Quaternion Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT23 SECTION "Quaternion" [9250-9351] -->
<!-- EDIT23 SECTION "Quaternion" [9283-9395] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -431,11 +431,11 @@ Quaternions define a subset of a hypercomplex number system. Quaternions are def
</p>
</p>
<p>
<p>
Additional benefits of the Quaternion is reducing the chance of <ahref="/com/jme3/gde/core/docs/jme3/gimbal_lock.html">Gimbal Lock</a> and allowing for easily interpolation between two rotations (spherical linear interpolation or slerp).
Additional benefits of the Quaternion is reducing the chance of <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://en.wikipedia.org/wiki/Gimbal_lock"><paramname="text"value="<html><u>Gimbal Lock</u></html>"><paramname="textColor"value="blue"></object> and allowing for easily interpolation between two rotations (spherical linear interpolation or slerp).
</p>
</p>
<p>
<p>
While Quaternions are quite difficult to fully understand, there are an exceeding number of convenience methods to allow you to use them without having to understand the math behind it. Basically, these methods involve nothing more than setting the Quaternion's x,y,z,w values using other means of representing rotations. The Quaternion is then contained in <ahref="/com/jme3/gde/core/docs/jme3/spatial.html">Spatial</a> as its local rotation component.
While Quaternions are quite difficult to fully understand, there are an exceeding number of convenience methods to allow you to use them without having to understand the math behind it. Basically, these methods involve nothing more than setting the Quaternion's x,y,z,w values using other means of representing rotations. The Quaternion is then contained in the <ahref="/com/jme3/gde/core/docs/jme3/advanced/spatial.html">Spatial</a> as its local rotation component.
</p>
</p>
<p>
<p>
@ -485,13 +485,13 @@ These basic operations allow us to convert various rotation representations to Q
</p>
</p>
</div>
</div>
<!-- EDIT24 SECTION "Definition" [9352-11461] -->
<!-- EDIT24 SECTION "Definition" [9396-11564] -->
<h3><a>Angle Axis</a></h3>
<h3><a>Angle Axis</a></h3>
<div>
<div>
<p>
<p>
You might wish to represent your rotations as Angle Axis pairs. That is, you define a axis of rotation and the angle with which to rotate about this axis. Quaternion defines a method <code>fromAngleAxis</code> (and <code>fromAngleNormalAxis</code>) to create a Quaternion from this pair. This is acutally used quite a bit in jME demos to continually rotate objects. You can also obtain a Angle Axis rotation from an existing Quaternion using <code>toAngleAxis</code>.
You might wish to represent your rotations as Angle Axis pairs. That is, you define a axis of rotation and the angle with which to <ahref="/com/jme3/gde/core/docs/jme3/rotate.html">rotate</a> about this axis. <ahref="/com/jme3/gde/core/docs/jme3/quaternion.html">Quaternion</a> defines a method <code>fromAngleAxis</code> (and <code>fromAngleNormalAxis</code>) to create a Quaternion from this pair. This is acutally used quite a bit in jME demos to continually rotate objects. You can also obtain a Angle Axis rotation from an existing Quaternion using <code>toAngleAxis</code>.
If you have three axes that define your rotation, where the axes define the left axis, up axis and directional axis respectively) you can make use of <code>fromAxes</code> to generate the Quaternion. It should be noted that this will generate a new <ahref="/com/jme3/gde/core/docs/jme3/matrix.html">Matrix</a> object that is then garbage collected, thus, this method should not be used if it will be called many times. Again, <code>toAxes</code> will populate a <ahref="/com/jme3/gde/core/docs/jme3/vector.html">Vector3f</a> array.
If you have three axes that define your rotation, where the axes define the left axis, up axis and directional axis respectively) you can make use of <code>fromAxes</code> to generate the Quaternion. It should be noted that this will generate a new <ahref="/com/jme3/gde/core/docs/jme3/matrix.html">Matrix</a> object that is then garbage collected, thus, this method should not be used if it will be called many times. Again, <code>toAxes</code> will populate a Vector3f array.
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/FastMath.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/FastMath.html"><paramname="text"value="<html><u>FastMath Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT32 SECTION "Fast Math" [15822-15919] -->
<!-- EDIT32 SECTION "Fast Math" [15922-16028] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -638,7 +638,7 @@ FastMath provides a number of convience methods, and where possible faster versi
@ -729,17 +729,17 @@ There are five major categories of functions that FastMath provides.
</ul>
</ul>
</div>
</div>
<!-- EDIT34 SECTION "Usage" [16074-18495] -->
<!-- EDIT34 SECTION "Usage" [16183-18604] -->
<h2><a>Line</a></h2>
<h2><a>Line</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Line.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Line.html"><paramname="text"value="<html><u>Line Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT35 SECTION "Line" [18496-18584] -->
<!-- EDIT35 SECTION "Line" [18605-18698] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -749,7 +749,7 @@ A line is a straight one-dimensional figure having no thickness and extending in
@ -763,24 +763,24 @@ jME defines a Line class that is defined by an origin and direction. In reality,
</p>
</p>
</div>
</div>
<!-- EDIT37 SECTION "Usage" [18799-19137] -->
<!-- EDIT37 SECTION "Usage" [18913-19251] -->
<h3><a>Example 1 - Find a Random Point on a Line</a></h3>
<h3><a>Example 1 - Find a Random Point on a Line</a></h3>
<div>
<div>
<pre>Line l = new Line(new Vector3f(0,1,0), new Vector3f(3,2,1));
<pre>Line l = new Line(new Vector3f(0,1,0), new Vector3f(3,2,1));
Vector3f randomPoint = l.random();</pre>
Vector3f randomPoint = l.random();</pre>
</div>
</div>
<!-- EDIT38 SECTION "Example 1 - Find a Random Point on a Line" [19138-19305] -->
<!-- EDIT38 SECTION "Example 1 - Find a Random Point on a Line" [19252-19419] -->
<h2><a>Plane</a></h2>
<h2><a>Plane</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Plane.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Plane.html"><paramname="text"value="<html><u>Plane Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT39 SECTION "Plane" [19306-19396] -->
<!-- EDIT39 SECTION "Plane" [19420-19516] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -814,7 +814,7 @@ This gives us the general equation: (ax + by + cz + d = 0)
<!-- EDIT42 SECTION "Example 1 - Determining if a Point is On the Positive Side of a Plane" [20811-21185] -->
<!-- EDIT42 SECTION "Example 1 - Determining if a Point is On the Positive Side of a Plane" [20931-21305] -->
<h3><a>Example 2 - For the Layperson</a></h3>
<h3><a>Example 2 - For the Layperson</a></h3>
<div>
<div>
@ -932,17 +932,17 @@ public class TestPlanes
}</pre>
}</pre>
</div>
</div>
<!-- EDIT43 SECTION "Example 2 - For the Layperson" [21186-23823] -->
<!-- EDIT43 SECTION "Example 2 - For the Layperson" [21306-23943] -->
<h2><a>Ray</a></h2>
<h2><a>Ray</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Ray.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Ray.html"><paramname="text"value="<html><u>Ray Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT44 SECTION "Ray" [23824-23910] -->
<!-- EDIT44 SECTION "Ray" [23944-24034] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -956,23 +956,23 @@ This Ray is used extensively in jME for <a href="/com/jme3/gde/core/docs/jme3/pi
<h3><a>Example 1 - Create a Ray That Represents Where the Camera is Looking</a></h3>
<h3><a>Example 1 - Create a Ray That Represents Where the Camera is Looking</a></h3>
<div>
<div>
<pre>Ray ray = new Ray(cam.getLocation(), cam.getDirection());</pre>
<pre>Ray ray = new Ray(cam.getLocation(), cam.getDirection());</pre>
</div>
</div>
<!-- EDIT46 SECTION "Example 1 - Create a Ray That Represents Where the Camera is Looking" [24278-24434] -->
<!-- EDIT46 SECTION "Example 1 - Create a Ray That Represents Where the Camera is Looking" [24402-24558] -->
<h2><a>Rectangle</a></h2>
<h2><a>Rectangle</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Rectangle.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Rectangle.html"><paramname="text"value="<html><u>Rectangle Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT47 SECTION "Rectangle" [24435-24533] -->
<!-- EDIT47 SECTION "Rectangle" [24559-24667] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -982,7 +982,7 @@ Rectangle defines a finite plane within three dimensional space that is specifie
@ -992,7 +992,7 @@ Rectangle is a straight forward data class that simply maintains values that def
</p>
</p>
</div>
</div>
<!-- EDIT49 SECTION "jME Usage" [24763-25077] -->
<!-- EDIT49 SECTION "jME Usage" [24897-25211] -->
<h3><a>Example 1 : Define a Rectangle and Get a Point From It</a></h3>
<h3><a>Example 1 : Define a Rectangle and Get a Point From It</a></h3>
<div>
<div>
<pre>Vector3f v1 = new Vector3f(1,0,0);
<pre>Vector3f v1 = new Vector3f(1,0,0);
@ -1002,17 +1002,17 @@ Rectangle r = new Rectangle(v1, v2, v3);
Vector3f point = r.random();</pre>
Vector3f point = r.random();</pre>
</div>
</div>
<!-- EDIT50 SECTION "Example 1 : Define a Rectangle and Get a Point From It" [25078-25337] -->
<!-- EDIT50 SECTION "Example 1 : Define a Rectangle and Get a Point From It" [25212-25471] -->
<h2><a>Triangle</a></h2>
<h2><a>Triangle</a></h2>
<div>
<div>
<p>
<p>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Triangle.html"><paramname="text"value="<html><u>Javadoc</u></html>"><paramname="textColor"value="blue"></object>
See <objectclassid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><paramname="content"value="http://www.jmonkeyengine.com/doc/com/jme/math/Triangle.html"><paramname="text"value="<html><u>Triangle Javadoc</u></html>"><paramname="textColor"value="blue"></object>
</p>
</p>
</div>
</div>
<!-- EDIT51 SECTION "Triangle" [25338-25434] -->
<!-- EDIT51 SECTION "Triangle" [25472-25577] -->
<h3><a>Definition</a></h3>
<h3><a>Definition</a></h3>
<div>
<div>
@ -1022,7 +1022,7 @@ A triangle is a 3-sided polygon. Every triangle has three sides and three angles
@ -124,9 +124,15 @@ Before you start creating your game, you should have completed the <a href="/com
</p>
</p>
<p>
<p>
The <ahref="/com/jme3/gde/core/docs/jme3.html">intermediate and advanced documentation</a> gives you more details on how to put all the parts together to create an awesome Java 3D game!
The <ahref="/com/jme3/gde/core/docs/jme3.html">intermediate and advanced documentation</a> gives you more details on how to put all the parts together to create an awesome 3D game in Java!
@ -69,7 +69,7 @@ You will notice a new file "MyLibrary.xml" is created in the plugins b
</p>
</p>
<p>
<p>
After you are done, you can <ahref="/com/jme3/gde/core/docs/sdk/development/setup#jmp_contributions_update_center.html">contribute the plugin in the jMonkeyEngine SDK contribution update center</a>.
After you are done, you can <ahref="/com/jme3/gde/core/docs/sdk/development/setup#jmonkeyengine_sdk_contributions_update_center.html">contribute the plugin in the jMonkeyEngine SDK contribution update center</a>.