lazy allocation of HeadData in getBroadcastData

This commit is contained in:
Stephen Birarda 2013-05-20 17:31:33 -07:00
parent 6392bb0045
commit d2b2d36fcf

View file

@ -68,6 +68,11 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
// that can pack any type given the number of bytes
// and return the number of bytes to push the pointer
// lazily allocate memory for HeadData in case we're not an Avatar instance
if (!_headData) {
_headData = new HeadData();
}
// Body world position
memcpy(destinationBuffer, &_position, sizeof(float) * 3);
destinationBuffer += sizeof(float) * 3;