Merge pull request #8278 from sethalves/fix-equip-fly-away

fix equip fly-away
This commit is contained in:
Chris Collins 2016-07-22 16:47:31 -07:00 committed by GitHub
commit e755528cf2
4 changed files with 23 additions and 13 deletions

View file

@ -1211,11 +1211,21 @@ EntityItemProperties EntityItem::getProperties(EntityPropertyFlags desiredProper
void EntityItem::getAllTerseUpdateProperties(EntityItemProperties& properties) const {
// a TerseUpdate includes the transform and its derivatives
properties._position = getLocalPosition();
properties._velocity = getLocalVelocity();
properties._rotation = getLocalOrientation();
properties._angularVelocity = getLocalAngularVelocity();
properties._acceleration = _acceleration;
if (!properties._positionChanged) {
properties._position = getLocalPosition();
}
if (!properties._velocityChanged) {
properties._velocity = getLocalVelocity();
}
if (!properties._rotationChanged) {
properties._rotation = getLocalOrientation();
}
if (!properties._angularVelocityChanged) {
properties._angularVelocity = getLocalAngularVelocity();
}
if (!properties._accelerationChanged) {
properties._acceleration = _acceleration;
}
properties._positionChanged = true;
properties._velocityChanged = true;

View file

@ -723,13 +723,10 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<Q
int index = changedProperties.indexOf("velocity");
if (index >= 0) {
glm::vec3 value = properties.getVelocity();
QString changeHint = "0";
if (value.x + value.y + value.z > 0) {
changeHint = "+";
} else if (value.x + value.y + value.z < 0) {
changeHint = "-";
}
changedProperties[index] = QString("velocity:") + changeHint;
changedProperties[index] = QString("velocity:") +
QString::number((int)value.x) + "," +
QString::number((int)value.y) + "," +
QString::number((int)value.z);
}
}

View file

@ -88,6 +88,7 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
motionState->updateBodyVelocities();
motionState->updateLastKinematicStep();
body->setSleepingThresholds(KINEMATIC_LINEAR_SPEED_THRESHOLD, KINEMATIC_ANGULAR_SPEED_THRESHOLD);
motionState->clearInternalKinematicChanges();
break;
}
case MOTION_TYPE_DYNAMIC: {

View file

@ -1915,7 +1915,9 @@ function MyController(hand) {
var handJointIndex = MyAvatar.getJointIndex(this.hand === RIGHT_HAND ? "RightHand" : "LeftHand");
var reparentProps = {
parentID: MyAvatar.sessionUUID,
parentJointIndex: handJointIndex
parentJointIndex: handJointIndex,
velocity: {x: 0, y: 0, z: 0},
angularVelocity: {x: 0, y: 0, z: 0}
};
if (hasPresetPosition) {
reparentProps["localPosition"] = this.offsetPosition;