terrain collision with irredit

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
Jack000
Posts: 5
Joined: Sun Jan 17, 2010 10:13 pm

terrain collision with irredit

Post by Jack000 »

Hi everyone

I'm using irrEdit to make my scene files, and loading the scene dynamically.

I'm trying to add a ISceneNodeAnimatorCollisionResponse to the terrain (following the terrain tutorial on this site).

the problem is that I have to grab the terrain node through smgr->getSceneNodeFromName(), which returns an ISceneNode instead of a terrain scene node. Is there a way to grab the terrain as a terrain node instead of a generic node, or maybe cast it as a terrain node somehow?

I could always create the terrain in code rather than use irrEdit, but this seems like such a silly problem that should have a solution..

thanks
CiRiuS2
Posts: 14
Joined: Mon Oct 26, 2009 12:14 am
Location: Spain

Post by CiRiuS2 »

I think you need simply a cast. Try this.

Code: Select all

ITerrainSceneNode *terrain = (ITerrainSceneNode*) smgr->getSceneNodeFromName("terrainname");
Jack000
Posts: 5
Joined: Sun Jan 17, 2010 10:13 pm

Post by Jack000 »

ah, thanks.

I tried casting before but it looks like I missed a star in there.. anyhoo, thanks again :]
Jack000
Posts: 5
Joined: Sun Jan 17, 2010 10:13 pm

Post by Jack000 »

one more question..

what's the best way of getting the triangle that is currently colliding? I guess I will need to draw a line, and use the triangle selector?

here's a shot of what I'm working on:

Image

there will be a hardware component, where I take the inclination of the virtual bike and use a stepper motor to match it using a bike trainer. This way we can simulate road texture like gravel, hills, mud, and speed bumps while riding in a virtual environment.

any tips on improving the terrain? It looks great from afar, but it's still a bit rough up close.
Post Reply