question about animatedmesh and billboard

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
moekkog
Posts: 44
Joined: Tue Feb 24, 2009 6:02 am

question about animatedmesh and billboard

Post by moekkog »

i have an array of animated mesh to control then but i want to know if i can do some kind of cast or something to put a billboard into the array for example

array[0] = IAnimatedMeshSceneNode
array[1] = IBillBoardSceneNode

is there any way to do that
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Just use core::array<scene::ISceneNode*> to store the objects. You need a cast when accessing special functions of the scene node types, though. Otherwise you can only use the basic ISceneNode methods.
moekkog
Posts: 44
Joined: Tue Feb 24, 2009 6:02 am

thanks

Post by moekkog »

thats will be helpful but can you give me an example of a cast that you toldme
Jookia
Posts: 170
Joined: Wed Nov 19, 2008 1:11 am

Post by Jookia »

I'm stupid, but I'd say one of these..

static_cast<specialclassname>(object)
dynamic_cast<specialclassname>(object)
reinterpret_cast<specialclassname>(object)
moekkog
Posts: 44
Joined: Tue Feb 24, 2009 6:02 am

Post by moekkog »

whats the different between all of them
Jookia
Posts: 170
Joined: Wed Nov 19, 2008 1:11 am

Post by Jookia »

/shrug

I don't know, all I know is that that may work or it may not.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

static_cast will work in most cases. If you have RTTI enabled you can use dynamic_cast instead, in order to have safe casts (will return 0 if you cast to the wrong types). Moreover, dynamic_cast is also necessary when upcasting from multi-inherited classes. reinterpret_cast is only necessary when casting structures without changing the underlying bit-level content. Mostly necessary for byte streams and C-style arrays.
moekkog
Posts: 44
Joined: Tue Feb 24, 2009 6:02 am

XDD

Post by moekkog »

well i did it in other way taking what you say as base first a declare a ISceneNode* array[64];
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh, I said it that way. But you should better get used to core::array (or std::vector) very soon. Will make your life easier.
Post Reply