MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / packUpdate

Method packUpdate

Engine/source/T3D/vehicles/vehicle.cpp:969–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967//----------------------------------------------------------------------------
968
969U32 Vehicle::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
970{
971 U32 retMask = Parent::packUpdate(con, mask, stream);
972
973 stream->writeFlag(mJetting);
974
975 // The rest of the data is part of the control object packet update.
976 // If we're controlled by this client, we don't need to send it.
977 if (stream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask)))
978 return retMask;
979
980 F32 yaw = (mSteering.x + mDataBlock->maxSteeringAngle) / (2 * mDataBlock->maxSteeringAngle);
981 F32 pitch = (mSteering.y + mDataBlock->maxSteeringAngle) / (2 * mDataBlock->maxSteeringAngle);
982 stream->writeFloat(yaw,9);
983 stream->writeFloat(pitch,9);
984 mDelta.move.pack(stream);
985
986 if (stream->writeFlag(mask & PositionMask))
987 {
988 stream->writeCompressedPoint(mRigid.linPosition);
989 mathWrite(*stream, mRigid.angPosition);
990 mathWrite(*stream, mRigid.linMomentum);
991 mathWrite(*stream, mRigid.angMomentum);
992 stream->writeFlag(mRigid.atRest);
993 }
994
995
996 stream->writeFloat(mClampF(getEnergyValue(), 0.f, 1.f), 8);
997
998 return retMask;
999}
1000
1001void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream)
1002{

Callers

nothing calls this directly

Calls 6

mathWriteFunction · 0.85
mClampFFunction · 0.85
writeFloatMethod · 0.80
writeCompressedPointMethod · 0.80
writeFlagMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected