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.
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.
#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
I will look up the setMaskBits function as see exactly what it does though.
Thanks for the suggestion anyway.
h
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
Torque Owner Harley
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;