Page 1 of 1

Updating mesh collisions

Posted: Fri Mar 27, 2009 10:12 pm
by Linaxys
Hello,
I'm editing a terrain mesh ingame (it's a hillPlane), and I'd like to know if there's a faster way than clearing it's triangle selector from the meta and recreate one everytime I raise a vertice...

I use this at each update :

Code: Select all

	node->setPosition(node->getPosition());
	getMeta()->removeTriangleSelector(selector);
	selector->drop();
	selector = makeCollisions();
	getMeta()->addTriangleSelector(selector);
And it's very very slow...

Thanks.

Posted: Fri Mar 27, 2009 10:32 pm
by Brkopac
Is there a reason you need to do this EVERYTIME you raise / lower or do whatever to the terrain? Why not make a button that updates it when you make multiple changes, or something of that sort?

Posted: Fri Mar 27, 2009 10:49 pm
by cobra
I'm doing this in my simulator's scenery editor. You raise the vertices on an ITerrainSceneNode.

Every time it's scale is changed, it changes onscreen text from "Terrain: Updated" to "Terrain: Not Updated", and then the user goes into the menu and selects "Update Terrain Node Data" and it updates it by doing this:

Code: Select all

terrain->setPosition(terrain->getPosition());
That forces it to update itself, and then the user can edit the nodes after that without it being glitchy.


Hope that helps.