Hi guys, from the "doors" tutorial I've managed to click on an object and recognise which object
type is, in particular i would like to recognise an animatable object, doing this:
Code:
if(Game::Animatable *Animatables=CAST(Game::Animatable,phys_hit.obj))[/php]
The declaration of Animatables is [code]Game::ObjMemx<Game::Animatable> Animatables;
And I load with the normal
Code:
.setObjType(Animatables, OBJ_ANIMATABLE)
in the game world init.
The debug show me that it goes correctly into the if, so the code until here is correct. My
problem is that after this cast I don't know how to access to that object properties, like meshes
etc. I saw the struct is:
Code:
STRUCT(Animatable , Obj) // Game Animatable Object
//{
Flt scale ; // scale
MeshPtr mesh ; // mesh
MaterialPtr material ; // overriding material
CSkeleton cskel ; // controlled skeleton
SkelAnim *skel_anim; // skeleton animation
PhysBodyPtr phys ; // physical body
Actor actor ; // actor
// manage
virtual void create(ObjParams &obj); // create from object parameters
// get / set
virtual Vec pos ( ); // get position
virtual void pos (C Vec &pos ); // set position
virtual Matrix matrix( ); // get matrix , returned matrix is normalized
virtual void matrix(C Matrix &matrix); // set matrix , 'matrix' must be normalized
// callbacks
virtual void memoryAddressChanged(); // called when object memory address has been
changed, you should override it and adjust Actor::obj pointer for all actors
// update
virtual Bool update(); // update, return false when object wants to be deleted, and true if wants to exist
// draw
virtual UInt drawPrepare(); // prepare for drawing, this will be called in RM_PREPARE mode, in this method you should add the meshes to the draw list (Mesh::draw), and return a combination of bits of which additional render modes will be required for custom drawing of the object (for example "return IndexToFlag(RM_BLEND)" requests blend mode rendering)
virtual void drawShadow (); // in this method you should add the meshes to the shadow draw list (Mesh::drawShadow)
// io
virtual void save(File &f); // save
virtual Bool load(File &f); // load, false on fail
~Animatable();
Animatable();
protected:
Matrix _matrix;
};
So, I've tried the normal access to a struct variable namestruct.namevariable but without
success. The -> too doesn't show me the properties, and the word Animatables is not either
recognised to be a variable, am I missing something?