| 967 | //---------------------------------------------------------------------------- |
| 968 | |
| 969 | U32 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 | |
| 1001 | void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream) |
| 1002 | { |
nothing calls this directly
no test coverage detected