Added thrust and velocity to avatar head, first part of movement improvements

This commit is contained in:
Philip Rosedale 2013-03-26 11:53:57 -07:00
parent bb14a90f86
commit e0ee6c269a
3 changed files with 23 additions and 2 deletions

View file

@ -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

View file

@ -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.

View file

@ -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;