How can I give my Spatial controlled by chaseCam gravity so it falls down on the terrain?
There are a few ways to do it. One of the most common ways is to add physics to your game. jMonkeyEngine 3 Tutorial (13) - Hello Physics :: jMonkeyEngine Docs and Physics: Gravity, Collisions, Forces :: jMonkeyEngine Docs give some good tutorials on getting the default bullet implementation up and running. Also, a lot of devs here also like @sgold’s Minie library, so you may be interested in adopting that once you get a handle on the tutorials (migrating isn’t too hard).
If you aren’t interested in a full-blown physics library, you can “fake it.” You can first create a Control that you can add to all entities affected by gravity (including your player) that will constantly accelerate the player by 9.8 unites/s/s (or whatever the rate of gravitational acceleration is in your game). Also, whenever you move the player (including when moving it by gravity), you can do a raytrace in the direction of movement to check if the movement will cause the player to intercept anything else (i.e., the terrain). This won’t be particurally accurate for walls and such, though, so you may want to back it up with multiple ray traces from different corners of your player’s hitbox.
At that point, though, you might as well implement a physics library. Its easier that way.
I fixed it. I forgot to use the following line:
That would do it!
Does someone know how to move a Spatial in chaseCam with WASD keys?
All ChaseCam does is cause the camera to follow a spatial wherever that spatial goes. If you want to move the player, you need to move the spatial. Again, the JME tutorials I linked go over this pretty well.
since OP use physics, then not spatial, but spatial physics object.