MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / unpackUpdate

Method unpackUpdate

Engine/source/T3D/entity.cpp:489–672  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489void Entity::unpackUpdate(NetConnection *con, BitStream *stream)
490{
491 Parent::unpackUpdate(con, stream);
492
493 if (stream->readFlag())
494 {
495 /*Point3F scale;
496 mathRead( *stream, &scale );
497 setScale( scale);*/
498
499 //MatrixF objToWorld;
500 //stream->readAffineTransform(&objToWorld);
501
502 Point3F pos;
503
504 stream->readCompressedPoint(&pos);
505 //mathRead(*stream, &pos);
506
507 RotationF rot;
508
509 mathRead(*stream, &rot);
510
511 mDelta.move.unpack(stream);
512
513 if (stream->readFlag() && isProperlyAdded())
514 {
515 // Determine number of ticks to warp based on the average
516 // of the client and server velocities.
517 /*mDelta.warpOffset = pos - mDelta.pos;
518
519 F32 dt = mDelta.warpOffset.len() / (0.5f * TickSec);
520
521 mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
522
523 //F32 as = (speed + mVelocity.len()) * 0.5f * TickSec;
524 //F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as : sMaxWarpTicks;
525 //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
526
527 //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f);
528
529 //mDelta.warpTicks = sMaxWarpTicks;
530
531 mDelta.warpTicks = 0;
532
533 if (mDelta.warpTicks)
534 {
535 // Setup the warp to start on the next tick.
536 if (mDelta.warpTicks > sMaxWarpTicks)
537 mDelta.warpTicks = sMaxWarpTicks;
538 mDelta.warpOffset /= (F32)mDelta.warpTicks;
539
540 mDelta.rot[0] = rot.asQuatF();
541 mDelta.rot[1] = rot.asQuatF();
542
543 mDelta.rotOffset = rot.asEulerF() - mDelta.rot.asEulerF();
544
545 // Ignore small rotation differences
546 if (mFabs(mDelta.rotOffset.x) < 0.001f)

Callers

nothing calls this directly

Calls 12

mathReadFunction · 0.85
mCeilFunction · 0.85
mFloorFunction · 0.85
readFlagMethod · 0.80
readCompressedPointMethod · 0.80
asQuatFMethod · 0.80
readIntMethod · 0.80
resolveGhostMethod · 0.80
unpackMethod · 0.45
lenMethod · 0.45
interpolateMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected