Getting the y-value of my Node at certain position

I'm new to jmonkeyengine… please be good to me… LOL!



My problem is that, i want to get the y-value of my Node at certain position(Like my character's position in the game)



I want something like this



terrain is a TerrainBlock<<<<



terrain.getHeight( mainPlayer.getLocalTranslation() )



TerrainBlock has a method that quickly gets the height at a certain location.



I was hoping there's a method for getting the Node's height as well…



I attached both my TerrainBlock and Box in a Node to think that my player can actually step both on my terrain and in the Box.



I was hoping there could be a workaround for this… Thanks!

if you want the height of the node, you can simply for the Y value from the translation vector:


mainPlayer.getLocalTranslation().getY();

I think he wants something different. As he mentioned terrainblock's getHeight(…)-method.

The easiest way to get the 'height' is to fire a ray from the position of the player downwards(0,-1,0)

and see what is hit and how far is the distance to the ray's origin. For that you need to use TrianglePickResults.

Have a look at this:



http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/jmetest/intersection/TestObjectWalking.java



Other approach would be to use jME-Bullet…



EDIT:

DO NOT DOUBLE-POST!!! Next time I won't answer!

ttrocha said:

I think he wants something different. As he mentioned terrainblock's getHeight(..)-method.
The easiest way to get the 'height' is to fire a ray from the position of the player downwards(0,-1,0)
and see what is hit and how far is the distance to the ray's origin. For that you need to use TrianglePickResults.
Have a look at this:

http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/jmetest/intersection/TestObjectWalking.java

Other approach would be to use jME-Bullet...

EDIT:
DO NOT DOUBLE-POST!!!! Next time I won't answer!


Yes I've seen the TestObjectWalking... I'm trying to make it in ThirdPerson... But I keep on getting so many NullPointerException...

regarding jME-Bullet... if its not much of a hustle for you, can you point me where I can see some good examples of a Third Person Game that has source codes...?

I have another Third Person code here but I pretty much want the idea of the TestObjectWalking where I can walk on the Nodes instead of just the terrain...

>>Sorry for the double post, I didn't know where to put my post <<