move to agent head position before drawing it

This commit is contained in:
Stephen Birarda 2013-02-21 14:45:33 -08:00
parent 9ec51116d5
commit 27c4702c7e
2 changed files with 5 additions and 3 deletions

View file

@ -344,7 +344,6 @@ int Head::getBroadcastData(char* data)
void Head::parseData(void *data, int size) {
// parse head data for this agent
std::cout << "HD: " << (char *)data << "\n";
sscanf((char *)data, "H%f,%f,%f,%f,%f,%f,%f,%f",
&Pitch, &Yaw, &Roll,
&position.x, &position.y, &position.z,

View file

@ -523,7 +523,6 @@ void update_pos(float frametime)
const int MAX_BROADCAST_STRING = 200;
char broadcast_string[MAX_BROADCAST_STRING];
int broadcast_bytes = myHead.getBroadcastData(broadcast_string);
std::cout << "BS: " << broadcast_string << "\n";
agentList.broadcastToAgents(broadcast_string, broadcast_bytes);
}
@ -586,7 +585,11 @@ void display(void)
// Render heads of other agents
for(std::vector<Agent>::iterator agent = agentList.agents.begin(); agent != agentList.agents.end(); agent++) {
if (agent->linkedData != NULL) {
((Head *)agent->linkedData)->render(0, &location[0]);
Head *agentHead = (Head *)agent->linkedData;
glm::vec3 pos = agentHead->getPos();
glTranslatef(-pos.x, -pos.y, -pos.z);
agentHead->render(0, &location[0]);
}
}