From e0ee6c269a856f2cf59de4d9d3df7784983425c1 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 26 Mar 2013 11:53:57 -0700 Subject: [PATCH] Added thrust and velocity to avatar head, first part of movement improvements --- interface/src/Head.cpp | 12 +++++++++++- interface/src/Head.h | 11 +++++++++++ shared/src/AgentList.cpp | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/interface/src/Head.cpp b/interface/src/Head.cpp index 4f22d010e0..65fd4089ef 100644 --- a/interface/src/Head.cpp +++ b/interface/src/Head.cpp @@ -42,7 +42,10 @@ GLUquadric *sphere = gluNewQuadric(); Head::Head() { - position.x = position.y = position.z = 0; + position = glm::vec3(0,0,0); + velocity = glm::vec3(0,0,0); + thrust = glm::vec3(0,0,0); + PupilSize = 0.10; interPupilDistance = 0.6; interBrowDistance = 0.75; @@ -88,6 +91,8 @@ Head::Head() Head::Head(const Head &otherHead) { position = otherHead.position; + velocity = otherHead.velocity; + thrust = otherHead.thrust; PupilSize = otherHead.PupilSize; interPupilDistance = otherHead.interPupilDistance; interBrowDistance = otherHead.interBrowDistance; @@ -207,6 +212,11 @@ void Head::setLeanSideways(float dist){ // Simulate the head over time void Head::simulate(float deltaTime) { + // Increment position as a function of velocity + position += velocity * deltaTime; + // Increment velocity as time + velocity += thrust * deltaTime; + if (!noise) { // Decay back toward center diff --git a/interface/src/Head.h b/interface/src/Head.h index 169aabea02..2c5733d28d 100644 --- a/interface/src/Head.h +++ b/interface/src/Head.h @@ -65,6 +65,11 @@ class Head : public AgentData { glm::vec3 getPos() { return position; }; void setPos(glm::vec3 newpos) { position = newpos; }; + // Set/Get update the thrust that will move the avatar around + void setThrust(glm::vec3 newThrust) { thrust = newThrust; }; + void addThrust(glm::vec3 newThrust) { thrust += newThrust; }; + glm::vec3 getThrust() { return thrust; }; + Hand * hand; private: @@ -103,8 +108,14 @@ class Head : public AgentData { float browAudioLift; glm::vec3 position; + glm::vec3 velocity; + glm::vec3 thrust; + + bool fwdKey, backKey, turnLeftKey, turnRightKey, slideLeftKey, slideRightKey, upKey, downKey; + int eyeContact; eyeContactTargets eyeContactTarget; + void readSensors(); float renderYaw, renderPitch; // Pitch from view frustum when this is own head. diff --git a/shared/src/AgentList.cpp b/shared/src/AgentList.cpp index 3ff902802c..072bdc1079 100644 --- a/shared/src/AgentList.cpp +++ b/shared/src/AgentList.cpp @@ -20,7 +20,7 @@ const char * SOLO_AGENT_TYPES_STRING = "MV"; char DOMAIN_HOSTNAME[] = "highfidelity.below92.com"; -char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be re-set by lookup on startup +char DOMAIN_IP[100] = ""; // IP Address will be re-set by lookup on startup const int DOMAINSERVER_PORT = 40102; bool silentAgentThreadStopFlag = false;