Game Development Community

Collision weirdness??

by Harley · in Torque Game Engine · 04/04/2005 (2:23 am) · 4 replies

Hey,
I have changed the Items object collision response code slightly (see below) so that the objects rebound a little better. What I have noticed is sometimes the mesh will stick to faces. What I managed to catch when I had the mission editor open was that the mesh may be sticking but the collision box (if thats what the yellow box is) was still moving around?! Any ideas on whats causing this? Where do I need to update the mesh?

Harley.

#1
04/04/2005 (2:32 am)
This is in the UpdatePos function in the Item class (around line 550 - 560 I think):

bd *= 1 + mDataBlock->elasticity;
VectorF dv = collision->normal * (bd + 0.002);
Point3F bounceVel = mVelocity - collision->normal * (mDot( mVelocity, collision->normal ) * 2.0);
mVelocity.x = bounceVel.x;
mVelocity.y = bounceVel.y;
mVelocity.z += dv.z; //These 2 lines stop the item getting stuff when it tries to go up a ramp shaped object
mVelocity.z -= fv.z;
#2
04/04/2005 (9:33 am)
Are you making sure to mark the position mask as dirty when you bounce so that it updates the client ghosts?
#3
04/05/2005 (1:24 am)
Sorry Ben, Im not sure what the position mask is?
#4
04/06/2005 (4:17 am)
I had another look tonight and found PositionMask (I have no idea what I was on last night as it is everywhere in the code, overtired me thinks). Anyway, How I fixed the problem was remove the mAtRest variable. Well the part that sets it to true. It seems to have stopped the object sticking.
I will look up the setMaskBits function as see exactly what it does though.

Thanks for the suggestion anyway.

h