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

Method unpackUpdate

Engine/source/T3D/physics/physicsShape.cpp:518–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518void PhysicsShape::unpackUpdate( NetConnection *con, BitStream *stream )
519{
520 Parent::unpackUpdate( con, stream );
521
522 if ( stream->readFlag() ) // InitialUpdateMask
523 {
524 MatrixF mat;
525 stream->readAffineTransform( &mat );
526 setTransform( mat );
527 mPlayAmbient = stream->readFlag();
528
529 if ( isProperlyAdded() )
530 _initAmbient();
531
532 if ( stream->readFlag() )
533 {
534 if ( isProperlyAdded() )
535 {
536 // Destroy immediately if we've already been added
537 // to the scene.
538 destroy();
539 }
540 else
541 {
542 // Indicate the shape should be destroyed when the
543 // shape is added.
544 mDestroyed = true;
545 }
546 }
547
548 return;
549 }
550
551 if ( stream->readFlag() ) // StateMask
552 {
553 PhysicsState state;
554
555 // Read the encoded and compressed position... commonly only 6.25 bytes.
556 stream->readCompressedPoint( &state.position );
557
558 // Read the compressed quaternion... 3.5 bytes.
559 stream->readQuat( &state.orientation, 9 );
560
561 state.sleeping = stream->readFlag();
562 if ( !state.sleeping )
563 {
564 stream->readVector( &state.linVelocity, 1000.0f, 16, 9 );
565 stream->readVector( &state.angVelocity, 10.0f, 10, 9 );
566 }
567
568 if ( !smNoCorrections && mPhysicsRep && mPhysicsRep->isDynamic() && !mDestroyed )
569 {
570 // Set the new state on the physics object immediately.
571 mPhysicsRep->applyCorrection( state.getTransform() );
572
573 mPhysicsRep->setSleeping( state.sleeping );
574 if ( !state.sleeping )
575 {

Callers

nothing calls this directly

Calls 13

destroyFunction · 0.85
readFlagMethod · 0.80
readAffineTransformMethod · 0.80
readCompressedPointMethod · 0.80
readQuatMethod · 0.80
readVectorMethod · 0.80
isDynamicMethod · 0.45
applyCorrectionMethod · 0.45
getTransformMethod · 0.45
setSleepingMethod · 0.45
setLinVelocityMethod · 0.45
setAngVelocityMethod · 0.45

Tested by

no test coverage detected