mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 05:17:34 +02:00
More info when colliding with meshes + stubbery for poking avatar.
This commit is contained in:
parent
2e65592048
commit
10296577f4
5 changed files with 22 additions and 6 deletions
|
@ -437,6 +437,20 @@ float Avatar::getHeight() const {
|
|||
return extents.maximum.y - extents.minimum.y;
|
||||
}
|
||||
|
||||
void Avatar::poke(ModelCollisionInfo& collision) {
|
||||
if (collision._model == &_skeletonModel
|
||||
&& collision._jointIndex != -1) {
|
||||
// TODO: Andrew to make this work
|
||||
printf("ADEBUG model = 0x%x joint = %d p = [%e, %e, %e]\n",
|
||||
collision._model,
|
||||
collision._jointIndex,
|
||||
collision._contactPoint.x,
|
||||
collision._contactPoint.y,
|
||||
collision._contactPoint.z
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
float Avatar::getPelvisFloatingHeight() const {
|
||||
return -_skeletonModel.getBindExtents().minimum.y;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,8 @@ public:
|
|||
|
||||
float getHeight() const;
|
||||
|
||||
void poke(ModelCollisionInfo& collision);
|
||||
|
||||
public slots:
|
||||
void updateCollisionFlags();
|
||||
|
||||
|
|
|
@ -219,16 +219,15 @@ void Hand::updateCollisions() {
|
|||
// add slapback here
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (avatar->findSphereCollisions(palm.getPosition(), scaledPalmRadius, collisions)) {
|
||||
for (size_t j = 0; j < collisions.size(); ++j) {
|
||||
totalPenetration = addPenetrations(totalPenetration, collisions[j]._penetration);
|
||||
// TODO: Andrew to poke avatar using collision info
|
||||
avatar->poke(collisions[i]);
|
||||
}
|
||||
// Check for collisions with the other avatar's leap palms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -474,10 +474,10 @@ bool Model::findSphereCollision(const glm::vec3& penetratorCenter, float penetra
|
|||
outerContinue: ;
|
||||
}
|
||||
if (jointIndex != -1) {
|
||||
// TODO? Andrew to store contactPoint
|
||||
// don't store collisionInfo._model at this stage, let the outer context do that
|
||||
collisionInfo._penetration = totalPenetration;
|
||||
collisionInfo._jointIndex = jointIndex;
|
||||
collisionInfo._contactPoint = penetratorCenter + penetratorRadius * glm::normalize(totalPenetration);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -21,17 +21,18 @@ public:
|
|||
CollisionInfo()
|
||||
: _damping(0.f),
|
||||
_elasticity(1.f),
|
||||
_contactPoint(0.f),
|
||||
_penetration(0.f),
|
||||
_addedVelocity(0.f) {
|
||||
}
|
||||
|
||||
~CollisionInfo() {}
|
||||
|
||||
//glm::vec3 _point;
|
||||
//glm::vec3 _normal;
|
||||
float _damping;
|
||||
float _elasticity;
|
||||
glm::vec3 _penetration; // depth that bodyA is penetrates bodyB
|
||||
glm::vec3 _contactPoint; // world-frame point on bodyA that is deepest into bodyB
|
||||
glm::vec3 _penetration; // depth that bodyA penetrates into bodyB
|
||||
glm::vec3 _addedVelocity;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue