[solved] I have no feet, and no gravity do I feel. Errm, please help

Hi,



TestObjectWalking.java demonstrates a nice “terrain following” example.

Chapter 7 of Wiki looks the place to be for my beginner’s question, however it being red means the answer is somewhere else (sounds like).



The test scene can be previewed here:





Please make a few assumption:

  • you have feet
  • you are standing on these feet (funny is it not)



    So, basically I'd love to implement terrain following and gravity. Based on the TestObjectWalking.java:
  1. You float in the air as you walk away from the box. I'd love to fall. At least, I'd love my character to fall (joke, again).
  2. Imagine you can fly (ye be a dragon). As you fly above the box, you suddenly land one the surface. It's like a magnet.



    Any good tutorial or snippet I should look at to solve these?

    Any help will be welcome! Thanks.

I have no feet, and no gravity do I feel. Errm, please help.

Lay off the mushrooms for a while...

:D sorry couldn't resist!

Both your questions can be answered by reading and understanding TestObjectWalking. What it does is:
1. fire a ray down (0,-1,0 direction) from the camera location
2. position the camera at the intersection point, plus (0, 10, 0) to be above the ground.
For the character/camera to "fall down", you'd just have to change that last bit to "position the camera at it's old location, but -0.1f in y direction - unless that would be on the other side of the intersection point".
I'll leave the details and making that framerate independent as an exercise for the reader :)
There is even a commented out part in TestObjectWalking that will make the camera "fly" when it ends up 5 units above the ground.

once you reach the "moving/animated random mesh <-> moving/animated random mesh with different behaviour (animated, stair, ladder, door, static, rope, evelator, spike, lava) collision"-level, you'll laugh about such simple problems.

i did.

owww pain

-> 3000 fps with y - 1 per frame made a hard landing  ://

I suppose that's why the movement must be framerate independent :slight_smile:



it's not yet m/s

oh hamsterz has posted in the meantime.

arrh, so, the stair is an issue :stuck_out_tongue:

Ok, thx for help - made me understand the picking basics.

Yay! Now on my way using the rays everywhere  XD