Struct model change

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
Mag-got
Posts: 42
Joined: Tue Dec 04, 2007 5:53 pm

Struct model change

Post by Mag-got »

Ok, there is the example of Irrlicht and Newton, where there is the "Old man's cube class", goes like this

Code: Select all

struct Cube{
IAnimatedMesh* mesh;
IAnimatedMeshSceneNode* node;
NewtonBody* body;
NewtonCollision * collision;
};
So, how could I change the cube's mesh? I can access it like cube->mesh, but there is no change function so how do I do it? Tried with
cube->mesh = smgr->getMesh(bla) but nope.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Not sure what you've trying to achieve....

are you changing the mesh after it's already been previously set?

using setMesh should work for changing the mesh, but that won't automatically update anything else like the node or the body...
Image Image Image
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Struct model change

Post by Acki »

Mag-got wrote:cube->mesh = smgr->getMesh(bla) but nope.
that should work... ;)
but of course this has no effect on the node or the collision, as far as you're only changing the mesh... :lol:
so when you're changing the mesh you'll also have to remove the old node and collision and create new ones...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Also, it would really help if you posted links to what you're referring to, rather than assuming that we know what "the example of Irrlicht and Newton" is supposed to mean. I might follow a link, but I'm certainly not going to search for the problem, rather than the solution.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Mag-got
Posts: 42
Joined: Tue Dec 04, 2007 5:53 pm

Post by Mag-got »

http://irrlicht.sourceforge.net/phpBB2/ ... 3e22620a27

Mercior's tutorial, modified by gbutcher

I don't really care about anything else than the mesh, so that means I have to destroy the old one and create a new one, you can't assign a new mesh to a node? :? Could've been easier.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You should look up the API, you *can* change a node's mesh via setMesh(), but that will only work for IMeshSceneNodes. The CubeNode is a MeshSceneNode in the next Irrlicht version, but it will refuse to change its mesh (otherwise it wouldn't be a good cube node :wink: ). But once you work with real meshes you'll see that it works as expected.
Post Reply