Fix position send message
This commit is contained in:
parent
8a248814da
commit
141afa2772
@ -9,8 +9,8 @@
|
|||||||
void NetworkSync::SendVector3(unsigned char *data, unsigned int &startIndex,
|
void NetworkSync::SendVector3(unsigned char *data, unsigned int &startIndex,
|
||||||
const Vector3 v) {
|
const Vector3 v) {
|
||||||
SendSingle100(data, startIndex, v.x);
|
SendSingle100(data, startIndex, v.x);
|
||||||
SendSingle100(data, startIndex += 4, v.y);
|
SendSingle100(data, startIndex, v.y);
|
||||||
SendSingle100(data, startIndex += 8, v.z);
|
SendSingle100(data, startIndex, v.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::SendQuaternion(unsigned char *data, const int startIndex,
|
void NetworkSync::SendQuaternion(unsigned char *data, const int startIndex,
|
||||||
@ -19,7 +19,7 @@ void NetworkSync::SendQuaternion(unsigned char *data, const int startIndex,
|
|||||||
int ix = startIndex;
|
int ix = startIndex;
|
||||||
SendAngle(data, ix++, angles.x);
|
SendAngle(data, ix++, angles.x);
|
||||||
SendAngle(data, ix++, angles.y);
|
SendAngle(data, ix++, angles.y);
|
||||||
SendAngle(data, ix, angles.z);
|
SendAngle(data, ix++, angles.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::SendQuat32(unsigned char *data, int startIndex,
|
void NetworkSync::SendQuat32(unsigned char *data, int startIndex,
|
||||||
@ -46,7 +46,7 @@ void NetworkSync::SendAngle(unsigned char *data, const int startIndex,
|
|||||||
data[startIndex] = packedAngle.GetValue();
|
data[startIndex] = packedAngle.GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::SendSingle100(unsigned char *data, const int startIndex,
|
void NetworkSync::SendSingle100(unsigned char *data, unsigned int &startIndex,
|
||||||
float value) {
|
float value) {
|
||||||
// Sends a float with truncated 2 decimal precision
|
// Sends a float with truncated 2 decimal precision
|
||||||
Int32 intValue = value * 100;
|
Int32 intValue = value * 100;
|
||||||
@ -56,10 +56,10 @@ void NetworkSync::SendSingle100(unsigned char *data, const int startIndex,
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::SendInt32(unsigned char *data, const int startIndex,
|
void NetworkSync::SendInt32(unsigned char *data, unsigned int &startIndex,
|
||||||
Int32 value) {
|
Int32 value) {
|
||||||
for (unsigned char ix = 0; ix < 4; ix++) {
|
for (unsigned char ix = 0; ix < 4; ix++) {
|
||||||
data[startIndex + ix] = ((unsigned char *)&value)[ix];
|
data[startIndex++] = ((unsigned char *)&value)[ix];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,9 @@ protected:
|
|||||||
NetworkPerception *networkPerception;
|
NetworkPerception *networkPerception;
|
||||||
void PublishTrackedObject(SendBuffer sendBuffer, InterestingThing *object);
|
void PublishTrackedObject(SendBuffer sendBuffer, InterestingThing *object);
|
||||||
|
|
||||||
void SendSingle100(unsigned char *data, const int startIndex, float value);
|
void SendSingle100(unsigned char *data, unsigned int &startIndex,
|
||||||
void SendInt32(unsigned char *data, const int startIndex, Int32 value);
|
float value);
|
||||||
|
void SendInt32(unsigned char *data, unsigned int &startIndex, Int32 value);
|
||||||
void SendAngle(unsigned char *data, const int startIndex, float value);
|
void SendAngle(unsigned char *data, const int startIndex, float value);
|
||||||
void SendVector3(unsigned char *data, unsigned int &startIndex,
|
void SendVector3(unsigned char *data, unsigned int &startIndex,
|
||||||
const Vector3 v);
|
const Vector3 v);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user