|
@@ -1,14 +1,10 @@
|
|
= Walking Character
|
|
= Walking Character
|
|
-:author:
|
|
|
|
-:revnumber:
|
|
|
|
-:revdate: 2016/03/17 20:48
|
|
|
|
|
|
+:revnumber: 2.0
|
|
|
|
+:revdate: 2020/07/15
|
|
:keywords: documentation, physics, input, animation, character, NPC, collision
|
|
:keywords: documentation, physics, input, animation, character, NPC, collision
|
|
-:relfileprefix: ../../
|
|
|
|
-:imagesdir: ../..
|
|
|
|
-ifdef::env-github,env-browser[:outfilesuffix: .adoc]
|
|
|
|
|
|
|
|
|
|
|
|
-In the <<jme3/beginner/hello_collision#,Hello Collision>> tutorial and the link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/bullet/TestQ3.java[TestQ3.java] code sample you have seen how to create collidable landscapes and walk around in a first-person perspective. The first-person camera is enclosed by a collision shape and is steered by the BetterCharacterControl.
|
|
|
|
|
|
+In the xref:tutorial:beginner/hello_collision.adoc[Hello Collision] tutorial and the link:https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-examples/src/main/java/jme3test/bullet/TestQ3.java[TestQ3.java] code sample you have seen how to create collidable landscapes and walk around in a first-person perspective. The first-person camera is enclosed by a collision shape and is steered by the BetterCharacterControl.
|
|
|
|
|
|
Other games however require a third-person perspective of the character: In these cases you use a CharacterControl on a Spatial. This example also shows how to set up custom navigation controls, so you can press WASD to make the third-person character walk; and how to implement dragging the mouse to rotate.
|
|
Other games however require a third-person perspective of the character: In these cases you use a CharacterControl on a Spatial. This example also shows how to set up custom navigation controls, so you can press WASD to make the third-person character walk; and how to implement dragging the mouse to rotate.
|
|
|
|
|
|
@@ -132,7 +128,7 @@ bulletAppState.getPhysicsSpace().add(myCharacter_phys);
|
|
|
|
|
|
[IMPORTANT]
|
|
[IMPORTANT]
|
|
====
|
|
====
|
|
-The BulletPhysics CharacterControl only collides with "`real`" PhysicsControls (RigidBody). It does not detect collisions with other CharacterControls! If you need additional collision checks, add GhostControls to your characters and create a custom <<jme3/advanced/physics_listeners#,collision listener>> to respond.
|
|
|
|
|
|
+The BulletPhysics CharacterControl only collides with "`real`" PhysicsControls (RigidBody). It does not detect collisions with other CharacterControls! If you need additional collision checks, add GhostControls to your characters and create a custom xref:jme3/advanced/physics_listeners.adoc[collision listener] to respond.
|
|
====
|
|
====
|
|
|
|
|
|
|
|
|
|
@@ -200,7 +196,7 @@ public class WalkingCharacterDemo extends SimpleApplication
|
|
|
|
|
|
To create a walking character:
|
|
To create a walking character:
|
|
|
|
|
|
-. (Unless you already have it) Activate physics in the scene by adding a <<jme3/advanced/physics#,BulletAppState>>.
|
|
|
|
|
|
+. (Unless you already have it) Activate physics in the scene by adding a xref:jme3/advanced/physics.adoc[BulletAppState].
|
|
. Init the scene by loading the game level model (terrain or floor/buildings), and giving the scene a MeshCollisionShape.
|
|
. Init the scene by loading the game level model (terrain or floor/buildings), and giving the scene a MeshCollisionShape.
|
|
. Create the animated character:
|
|
. Create the animated character:
|
|
.. Load an animated character model.
|
|
.. Load an animated character model.
|