anchor.diff:  = terrain_collision
   :author:
   :revnumber:
  -:revdate: 2016/03/17 20:48
  +:revdate: 2020/07/15
   :keywords: terrain, collision
  -:relfileprefix: ../../
  -:imagesdir: ../..
  -:experimental:
  -ifdef::env-github,env-browser[:outfilesuffix: .adoc]
   
   
   
   == Terrain Collision
   
  -This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in <<jme3/beginner/hello_terrain#,Hello Terrain>> and <<jme3/beginner/hello_collision#,Hello Collision>> and add a CollisionShape to the terrain. The terrain's CollisionShape lets the first-person player (who is also a CollisionShape) collide with the terrain, i.e. walk on it and stand on it.
  +This tutorial expands the HelloTerrain tutorial and makes the terrain solid. You combine what you learned in xref:tutorials:beginner/hello_terrain.adoc[Hello Terrain] and xref:tutorials:beginner/hello_collision.adoc[Hello Collision] and add a CollisionShape to the terrain. The terrain's CollisionShape lets the first-person player (who is also a CollisionShape) collide with the terrain, i.e. walk on it and stand on it.
   
   
   == Sample Code
  
positive.code: 
  === The Collision Detection Code
  
  Read <<jme3/beginner/hello_collision#,Hello Collision>> for details of the following parts that we reuse:
  
  .  The `BulletAppState` lines activate physics.
  .  The `ActionListener` (`onAction()`) lets you reconfigure the input handling for the first-person player, so it takes collision detection into account.
  
negative.code: 
  === The Terrain Code
  
  Read xref:tutorials:beginner/hello_terrain.adoc[Hello Terrain] for details of the following parts that we reuse:
  
  .  The `AbstractHeightMap` is an efficient way to describe the shape of the terrain.
  .  The `Terrain.j3md`-based Material and its texture layers let you colorize rocky mountain, grassy valleys, and a paved path criss-crossing over the landscape.
  