mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:22:57 +02:00
merge
This commit is contained in:
commit
b5e7c30178
1 changed files with 8 additions and 3 deletions
|
@ -62,6 +62,7 @@ MyAvatar::MyAvatar() :
|
||||||
_isThrustOn(false),
|
_isThrustOn(false),
|
||||||
_thrustMultiplier(1.0f),
|
_thrustMultiplier(1.0f),
|
||||||
_moveTarget(0,0,0),
|
_moveTarget(0,0,0),
|
||||||
|
_lastBodyPenetration(0.0f),
|
||||||
_moveTargetStepCounter(0),
|
_moveTargetStepCounter(0),
|
||||||
_lookAtTargetAvatar(),
|
_lookAtTargetAvatar(),
|
||||||
_shouldRender(true),
|
_shouldRender(true),
|
||||||
|
@ -681,7 +682,7 @@ void MyAvatar::updateThrust(float deltaTime) {
|
||||||
_thrust -= _driveKeys[DOWN] * _scale * THRUST_MAG_DOWN * _thrustMultiplier * deltaTime * up;
|
_thrust -= _driveKeys[DOWN] * _scale * THRUST_MAG_DOWN * _thrustMultiplier * deltaTime * up;
|
||||||
|
|
||||||
// attenuate thrust when in penetration
|
// attenuate thrust when in penetration
|
||||||
if (glm::dot(_thrust, _lastBodyPenetration) > 0.0f) {
|
if (glm::dot(_thrust, _lastBodyPenetration) > EPSILON) {
|
||||||
const float MAX_BODY_PENETRATION_DEPTH = 0.6f * _skeletonModel.getBoundingShapeRadius();
|
const float MAX_BODY_PENETRATION_DEPTH = 0.6f * _skeletonModel.getBoundingShapeRadius();
|
||||||
float penetrationFactor = glm::min(1.0f, glm::length(_lastBodyPenetration) / MAX_BODY_PENETRATION_DEPTH);
|
float penetrationFactor = glm::min(1.0f, glm::length(_lastBodyPenetration) / MAX_BODY_PENETRATION_DEPTH);
|
||||||
glm::vec3 penetrationDirection = glm::normalize(_lastBodyPenetration);
|
glm::vec3 penetrationDirection = glm::normalize(_lastBodyPenetration);
|
||||||
|
@ -909,7 +910,7 @@ void MyAvatar::updateCollisionWithAvatars(float deltaTime) {
|
||||||
updateShapePositions();
|
updateShapePositions();
|
||||||
float myBoundingRadius = getBoundingRadius();
|
float myBoundingRadius = getBoundingRadius();
|
||||||
|
|
||||||
const float BODY_COLLISION_RESOLUTION_FACTOR = deltaTime / BODY_COLLISION_RESOLUTION_TIMESCALE;
|
const float BODY_COLLISION_RESOLUTION_FACTOR = glm::max(1.0f, deltaTime / BODY_COLLISION_RESOLUTION_TIMESCALE);
|
||||||
|
|
||||||
foreach (const AvatarSharedPointer& avatarPointer, avatars) {
|
foreach (const AvatarSharedPointer& avatarPointer, avatars) {
|
||||||
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
|
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
|
||||||
|
@ -932,7 +933,11 @@ void MyAvatar::updateCollisionWithAvatars(float deltaTime) {
|
||||||
|
|
||||||
CollisionInfo collision;
|
CollisionInfo collision;
|
||||||
if (ShapeCollider::collideShapesCoarse(myShapes, theirShapes, collision)) {
|
if (ShapeCollider::collideShapesCoarse(myShapes, theirShapes, collision)) {
|
||||||
if (glm::length2(collision._penetration) > EPSILON) {
|
float penetrationDepth = glm::length(collision._penetration);
|
||||||
|
if (penetrationDepth > myBoundingRadius) {
|
||||||
|
qDebug() << "WARNING: ignoring avatar-avatar penetration depth " << penetrationDepth;
|
||||||
|
}
|
||||||
|
else if (penetrationDepth > EPSILON) {
|
||||||
setPosition(getPosition() - BODY_COLLISION_RESOLUTION_FACTOR * collision._penetration);
|
setPosition(getPosition() - BODY_COLLISION_RESOLUTION_FACTOR * collision._penetration);
|
||||||
_lastBodyPenetration += collision._penetration;
|
_lastBodyPenetration += collision._penetration;
|
||||||
emit collisionWithAvatar(getSessionUUID(), avatar->getSessionUUID(), collision);
|
emit collisionWithAvatar(getSessionUUID(), avatar->getSessionUUID(), collision);
|
||||||
|
|
Loading…
Reference in a new issue