Game Development Community

Item update position problem

by Santosh Pillai · in Torque Game Engine · 02/23/2008 (3:14 am) · 3 replies

Hi All, i am trying to move my item object ( on circular path , i tried with script but it was not smooth ). Then i moved all update position to engine. Now its smooth but there is difference in update between server and client ( i.e object bounding box is at different position and object is at different position )

here is code ( void Item::processTick(const Move* move) )
if( mDataBlock->mRotate && isPlayerSet )
{
Point3F pos;
mObjToWorld.getColumn(3,&pos);
int rotCount = Con::getIntVariable( "$refangle" ) ;//dAtoi( rotateCnt );

fRotAmt = ( pLayerCount * 0.624) - ( rotCount * 0.005 );
MatrixF mat = mObjToWorld;

F32 newXPos = 362.00 + 4 * mCos( fRotAmt );
F32 newYPos = 430.58 + 4 * mSin( fRotAmt );
mat.setColumn( 3, Point3F( newXPos, newYPos, pos.z ) );

pLayerCount++;
if( pLayerCount > 10 )
{
pLayerCount = 1;
}


pos = Point3F( newXPos, newYPos, pos.z );
this->setPosition( pos );
//Parent::setTransform( mat );
updatePos( isGhost() ? sClientCollisionMask : sServerCollisionMask, TickSec);
}

what is wrong in this. After hour of debug i found that there is problem with updatePos
but if i removed it then the movement is jerky.

// If on the client, calculate delta for backstepping
if ( isGhost() )
{
delta.pos = pos;
delta.posVec -= pos;
delta.dt = 0;
}



This part of the code is causing problem. How i can have update both server and client position simultaneously?

#1
02/23/2008 (11:35 pm)
IS there any one can please tell me whats wrong i am doing.
#2
02/24/2008 (12:03 am)
www.garagegames.com/mg/forums/result.thread.php?qt=47498

There's a bug with the source related to movement of items, at least via the world editor.
I found a fix for it in this case, maybe it's related?

take an item, set it to be active or whatever it is that gives it gravity, then drag it upwards and let it drop. you can see the bounding box move smoothly, but not the actual item.
#3
02/24/2008 (4:14 am)
Thanks for reply Ramen-sama. Now BB and actual have same position, but movement is jerky.