collision "masks" using CollisionResponseAnimator

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
DarksideX
Posts: 22
Joined: Wed Dec 10, 2008 7:42 am

collision "masks" using CollisionResponseAnimator

Post by DarksideX »

Hello, im making a 3d platformer.

Currently i have a non-animated non-rotated tank mesh that has collisions with a 3ds file. It works perfectly.

My problem is, whenever i rotate the tank the collision changes alittle bit. It seems as if the collision "mask" for the tank changes when i change rotation. Is this true? If yes. Then can i make it so the collision mask is constantly the same non-dependent of rotation or animation?

This is what i use for rotation:

Code: Select all

//XDir is the direction the character is facing, 1 right -1 left

draPlayer->setRotation(vector3df(0,objPlayer.YRot,0));

switch(objPlayer.XDir){
case 1:
if(objPlayer.YRot>180){
 objPlayer.YRot-=10;                      
}else{objPlayer.YRot=180;}   
break;
case -1:
if(objPlayer.YRot<360){
objPlayer.YRot+=10;                      
}else{objPlayer.YRot=360;}                    
break;
}
And here is my collision animator:

Code: Select all

//ColW,ColH,ColD are set to 10,20,10
ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator( selector , draPlayer ,  vector3df(objPlayer.ColW,objPlayer.ColH,objPlayer.ColD), vector3df(0,0,0) );

Thank you.

-Ali
robertgarand
Posts: 69
Joined: Fri Feb 22, 2008 6:47 pm
Location: montreal
Contact:

The Boundingbox is axis aligned

Post by robertgarand »

Hi,
Not sure but I think it could be that the boundingbox is axis aligned:

Code: Select all

//! set user axis aligned bounding box
		/** \param box New bounding box to use for the mesh. */
		virtual void setBoundingBox( const core::aabbox3df& box) = 0;
From Imesh type declaration. So if your square object is rotated, it must not be aligne with axis so there will be "dead angles".



The corners are include in box width of tank diagonal, tried to make a draw, not very persuasive...Maybe you can try debug view of box to verify.
Robert
If it can't be writen, it can't exist
Post Reply