Added --local option to avatar-mixer for testing. Only update velocity,

acceleration, angular velocity, etc., for local avatar.
This commit is contained in:
Andrzej Kapolka 2013-05-30 12:33:05 -07:00
parent 342e19aa41
commit 28531fcae0
2 changed files with 85 additions and 79 deletions

View file

@ -55,6 +55,14 @@ int main(int argc, const char* argv[]) {
AgentList* agentList = AgentList::createInstance(AGENT_TYPE_AVATAR_MIXER, AVATAR_LISTEN_PORT);
setvbuf(stdout, NULL, _IOLBF, 0);
// Handle Local Domain testing with the --local command line
const char* local = "--local";
if (cmdOptionExists(argc, argv, local)) {
printf("Local Domain MODE!\n");
int ip = getLocalAddress();
sprintf(DOMAIN_IP,"%d.%d.%d.%d", (ip & 0xFF), ((ip >> 8) & 0xFF),((ip >> 16) & 0xFF), ((ip >> 24) & 0xFF));
}
agentList->linkedDataCreateCallback = attachAvatarDataToAgent;
agentList->startDomainServerCheckInThread();

View file

@ -304,13 +304,10 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
up;
}
}
}
// update body yaw by body yaw delta
if (!_owningAgent) {
orientation = orientation * glm::quat(glm::radians(
glm::vec3(_bodyPitchDelta, _bodyYawDelta, _bodyRollDelta) * deltaTime));
}
// decay body rotation momentum
float bodySpinMomentum = 1.0 - BODY_SPIN_FRICTION * deltaTime;
@ -355,7 +352,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
}
// If another avatar is near, dampen velocity as a function of closeness
if (!_owningAgent && (_distanceToNearestAvatar < PERIPERSONAL_RADIUS)) {
if (_distanceToNearestAvatar < PERIPERSONAL_RADIUS) {
float closeness = 1.0f - (_distanceToNearestAvatar / PERIPERSONAL_RADIUS);
float drag = 1.0f - closeness * AVATAR_BRAKING_STRENGTH * deltaTime;
if ( drag > 0.0f ) {
@ -393,6 +390,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
// correct the oculus yaw offset
OculusManager::updateYawOffset();
}
}
//apply the head lean values to the springy position...
if (USING_HEAD_LEAN) {