mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
experimenting
This commit is contained in:
parent
27ed0c4a98
commit
ee000f91ae
1 changed files with 17 additions and 8 deletions
|
@ -369,6 +369,9 @@ void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) {
|
||||||
void PhysicsEngine::computeCollisionEvents() {
|
void PhysicsEngine::computeCollisionEvents() {
|
||||||
BT_PROFILE("computeCollisionEvents");
|
BT_PROFILE("computeCollisionEvents");
|
||||||
|
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
QUuid myNodeID = nodeList->getSessionUUID();
|
||||||
|
|
||||||
const btCollisionObject* characterCollisionObject =
|
const btCollisionObject* characterCollisionObject =
|
||||||
_characterController ? _characterController->getCollisionObject() : NULL;
|
_characterController ? _characterController->getCollisionObject() : NULL;
|
||||||
|
|
||||||
|
@ -398,20 +401,26 @@ void PhysicsEngine::computeCollisionEvents() {
|
||||||
|
|
||||||
// if our character capsule is colliding with something dynamic, claim simulation ownership.
|
// if our character capsule is colliding with something dynamic, claim simulation ownership.
|
||||||
// see EntityMotionState::sendUpdate
|
// see EntityMotionState::sendUpdate
|
||||||
if (objectA == characterCollisionObject && !objectB->isStaticOrKinematicObject() && b) {
|
// if (objectA == characterCollisionObject && !objectB->isStaticOrKinematicObject() && b) {
|
||||||
entityB->setShouldClaimSimulationOwnership(true);
|
// entityB->setShouldClaimSimulationOwnership(true);
|
||||||
}
|
// }
|
||||||
if (objectB == characterCollisionObject && !objectA->isStaticOrKinematicObject() && a) {
|
// if (objectB == characterCollisionObject && !objectA->isStaticOrKinematicObject() && a) {
|
||||||
entityA->setShouldClaimSimulationOwnership(true);
|
// entityA->setShouldClaimSimulationOwnership(true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// collisions cause infections spread of simulation-ownership. we also attempt to take
|
||||||
|
// ownership of anything that collides with our avatar.
|
||||||
if (entityA && entityB &&
|
if (entityA && entityB &&
|
||||||
!objectA->isStaticOrKinematicObject() &&
|
!objectA->isStaticOrKinematicObject() &&
|
||||||
!objectB->isStaticOrKinematicObject()) {
|
!objectB->isStaticOrKinematicObject()) {
|
||||||
if (entityA->getShouldClaimSimulationOwnership()) {
|
if (entityA->getSimulatorID() == myNodeID ||
|
||||||
|
entityA->getShouldClaimSimulationOwnership() ||
|
||||||
|
objectA == characterCollisionObject) {
|
||||||
entityB->setShouldClaimSimulationOwnership(true);
|
entityB->setShouldClaimSimulationOwnership(true);
|
||||||
}
|
}
|
||||||
else if (entityB->getShouldClaimSimulationOwnership()) {
|
if (entityB->getSimulatorID() == myNodeID ||
|
||||||
|
entityB->getShouldClaimSimulationOwnership() ||
|
||||||
|
objectB == characterCollisionObject) {
|
||||||
entityA->setShouldClaimSimulationOwnership(true);
|
entityA->setShouldClaimSimulationOwnership(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue