Heightfeild Tessalator terrain height?

:question:
Ok well my computer club at school is using panda to make some games for a game competition. This is my first time using panda. But i’m not a noob programmer either. I’ve used other 3D librarys like Irrlicht and Ogre. Python is new to me also but I pretty much got it figured out. I’m having trouble getting the heightfeild tessalator to work in a timely fashion so I came to the forums for help.

class Terrain:
  def __init__ (self):
    self.terrainmap = HeightfieldTesselator  ("Heightmap")  
    self.terrainmap.setHeightfield (Filename("Art/Heightmap.PNG"))
    self.UpdateTerrain ()
    
  def UpdateTerrain (self):
    self.terrainmap.setHorizontalScale( 3 ) 
    self.terrainmap.setVerticalScale( 100)
    self.terrainmap.setFocalPoint (cam.x,cam.y)
    self.terrainNode = self.terrainmap.generate ()
    self.terrainNode.setTexGen( TextureStage.getDefault( ), TexGenAttrib.MWorldPosition )
    self.terrainNode.setTexScale( TextureStage.getDefault( ), 0.05, 0.05 ) 
    self.terrainNode.setTexture (loader.loadTexture ("Art/Grass.jpg"),1)
    self.terrainNode.setPos (0,0,0)
  def Draw (self):
    self.terrainNode.reparentTo (render)
  def GetHeightAt (self,x,y):
    nx = x/3
    ny = y/3
    return self.terrainmap.getElevation (nx,ny)

Its crappy at the moment but the problem lies in the GetHeighAt function…

First of all where in my terrain in 3D space is 0,0 in terms of pixels getElevation wants a pixel amount to bad for us were in 3D which doesnt have pixels :imp: When I move towards the terrain I get a -y value!!!
but the terrainNode has a position of 0,0,0!!!

So if my rendered heightmap is thus…

+-----------+
|           |
|           | 
|           |
+-----------+

Which corner is the Node at and which corner is 0,0 pixel?

Well I seem to have hit the spot after i posted this so the fix looks like this.

class Terrain:
  def __init__ (self):
    self.terrainmap = HeightfieldTesselator  ("Heightmap")  
    self.terrainmap.setHeightfield (Filename("Art/Heightmap2.PNG"))
    self.vScale = 100
    self.hScale = 3
    self.UpdateTerrain ()
   
    
  def UpdateTerrain (self):
    self.terrainmap.setHorizontalScale( self.hScale ) 
    self.terrainmap.setVerticalScale( self.vScale)
    self.terrainmap.setFocalPoint (cam.x,cam.y)
    self.terrainNode = self.terrainmap.generate ()
    self.terrainNode.setTexGen( TextureStage.getDefault( ), TexGenAttrib.MWorldPosition )
    self.terrainNode.setTexScale( TextureStage.getDefault( ), 0.05, 0.05 ) 
    self.terrainNode.setTexture (loader.loadTexture ("Art/Grass.jpg"),1)
    self.terrainNode.setPos (0,0,0)
    
  def Draw (self):
    self.terrainNode.reparentTo (render)
  def GetHeightAt (self,x,y):
    nx = x/self.hScale
    ny = -y/self.hScale
    return self.terrainmap.getElevation (nx,ny)*self.vScale

I am a panda newbie myself. And I will be interested when someone, more knowlegeble responds to your question. But it would help everyone follow along if you posted the png and any other external files and resources somewhere so that if we try your code and whatever solution you get it will actually run.