How to adjust somthing to the ground

if i simply do this:

public void rotateUpToTerrainNormal()
  {

    //noinspection ConstantConditions
    final Vector3f l_up = ms_core.getTerrain().getSurfaceNormal(getWorldCenter(), ms_tmp);
    if (l_up != null)
    {
      rotateUpTo(l_up);
      afterMove();
    }
  }



my object, in my case a spider, has the correct angle, but floats a bit above the ground. i guess it's rotated around its center, but that's wrong - it has to be rotated around the center where it touches the terrain, or change the up vector and move it "downwards" by the right distance. how can i do that?


does jme's built in rotate to normal method have the same effect, its demonstrated in flagrush 7 or 8 and a couple other tests I think

Have you checked in a modelling program if the center of rotation (pivot) is correctly placed for the spider?

wild guess:

the first rotiation is correct, then the bounding box is modified, gets bigger, and then the model is moved upwards…

have to think about that

Oriented bounding box?

doesn't matter, right now the hhexen engine assumes the lowest point to be the one that must be moved upwards until it matches the terrain height at below the nodes center

Then that would be your problem… The lowest point after rotation does not correspond with your lowest point before rotation. Am I missing something?



  /
 /.
/   /
   /
  /



Versus



==.==