mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
Set collision threashold to walking speed
This commit is contained in:
parent
4e8b61dea0
commit
e2fa734024
1 changed files with 2 additions and 2 deletions
|
@ -322,7 +322,7 @@ void AvatarManager::handleCollisionEvents(const CollisionEvents& collisionEvents
|
||||||
const auto characterController = myAvatar->getCharacterController();
|
const auto characterController = myAvatar->getCharacterController();
|
||||||
const float avatarVelocityChange = (characterController ? glm::length(characterController->getVelocityChange()) : 0.0f);
|
const float avatarVelocityChange = (characterController ? glm::length(characterController->getVelocityChange()) : 0.0f);
|
||||||
const float velocityChange = glm::length(collision.velocityChange) + avatarVelocityChange;
|
const float velocityChange = glm::length(collision.velocityChange) + avatarVelocityChange;
|
||||||
const float MIN_AVATAR_COLLISION_ACCELERATION = 0.3f; // ~ 1km/h ==> sound volume = 0.09
|
const float MIN_AVATAR_COLLISION_ACCELERATION = 2.4f; // walking speed
|
||||||
const bool isSound = (collision.type == CONTACT_EVENT_TYPE_START) && (velocityChange > MIN_AVATAR_COLLISION_ACCELERATION);
|
const bool isSound = (collision.type == CONTACT_EVENT_TYPE_START) && (velocityChange > MIN_AVATAR_COLLISION_ACCELERATION);
|
||||||
|
|
||||||
if (!isSound) {
|
if (!isSound) {
|
||||||
|
@ -330,7 +330,7 @@ void AvatarManager::handleCollisionEvents(const CollisionEvents& collisionEvents
|
||||||
}
|
}
|
||||||
// Your avatar sound is personal to you, so let's say the "mass" part of the kinetic energy is already accounted for.
|
// Your avatar sound is personal to you, so let's say the "mass" part of the kinetic energy is already accounted for.
|
||||||
const float energy = velocityChange * velocityChange;
|
const float energy = velocityChange * velocityChange;
|
||||||
const float COLLISION_ENERGY_AT_FULL_VOLUME = 1.0;
|
const float COLLISION_ENERGY_AT_FULL_VOLUME = 10.0f;
|
||||||
const float energyFactorOfFull = fmin(1.0f, energy / COLLISION_ENERGY_AT_FULL_VOLUME);
|
const float energyFactorOfFull = fmin(1.0f, energy / COLLISION_ENERGY_AT_FULL_VOLUME);
|
||||||
|
|
||||||
// For general entity collisionSoundURL, playSound supports changing the pitch for the sound based on the size of the object,
|
// For general entity collisionSoundURL, playSound supports changing the pitch for the sound based on the size of the object,
|
||||||
|
|
Loading…
Reference in a new issue