getHeight for animatedmesh or polygon mesh

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

getHeight for animatedmesh or polygon mesh

Post by thanhle »

Hi everyone,

Does anyone know how or have a function to get height point for animated mesh?
I want to supply the x, z and the near Y coordinate to the mesh. Then find out the nearest height (normal) point on the mesh polygon. This way I can have my character walk into cave autonomously.

I don't want to use the collision manager, because there is some performance reduction using it. If I use the collision manager in multiple thread app. it will cause exception. It would be nice to have a clone function for collision manager? This way I can do parallel collision detection.

At the moment I'm using recast detour, after it returned a 2D path, I used detour geometry function to get the nearest height. But there are some bugs in detour library, which makes the height returned wrongly at some corner edges causing my characters to fall down. I get around this problem by using the interpolated current position Y with the next position Y to determine the next point. Everything works, but I want to make sure irrlicht has better way of doing it.

Thanks
thanh
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: getHeight for animatedmesh or polygon mesh

Post by smso »

I used the transformed bounding box for finding the y-offset to prevent the character from walking below the ground, e.g.

Code: Select all

f32 getAnimatedMeshSceneNodeYOffset(scene::IAnimatedMeshSceneNode*  node)
{
    f32 scale = 1.0f;
    scene::ISceneNode* parent = node->getParent();
    if (parent)
        scale = parent->getScale().Y;
 
    return node->getTransformedBoundingBox().getExtent().Y * 0.5f * scale;
}
 
Regards,
smso
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: getHeight for animatedmesh or polygon mesh

Post by thanhle »

Thanks smso,
Unfortunately my mesh is not flat. It has holes, slope and things like that. For example it's a castle or a tunnel.
That's why I want to ask for polygon level of intersection.
E.g. Project a line straight in the Y downward direction from the character center height.
If there is no such function I will find time to write it.

Thanks
Thanh
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: getHeight for animatedmesh or polygon mesh

Post by hendu »

This is what physics systems like Bullet are for. Irr doesn't have a way other than the slow collision manager.
Post Reply