mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:12:46 +02:00
better movement near others
This commit is contained in:
parent
f2ef80b704
commit
6281a28f69
1 changed files with 6 additions and 4 deletions
|
@ -221,12 +221,14 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
|
||||||
// Damp avatar velocity
|
// Damp avatar velocity
|
||||||
const float LINEAR_DAMPING_STRENGTH = 0.5f;
|
const float LINEAR_DAMPING_STRENGTH = 0.5f;
|
||||||
const float SPEED_BRAKE_POWER = _scale * 10.0f;
|
const float SPEED_BRAKE_POWER = _scale * 10.0f;
|
||||||
const float SQUARED_DAMPING_STRENGTH = 0.007f;
|
const float SQUARED_DAMPING_STRENGTH = 0.007f;
|
||||||
|
|
||||||
|
const float SLOW_NEAR_RADIUS = 5.f;
|
||||||
float linearDamping = LINEAR_DAMPING_STRENGTH;
|
float linearDamping = LINEAR_DAMPING_STRENGTH;
|
||||||
const float AVATAR_DAMPING_FACTOR = 120.f;
|
const float NEAR_AVATAR_DAMPING_FACTOR = 50.f;
|
||||||
if (_distanceToNearestAvatar < _scale * PERIPERSONAL_RADIUS) {
|
if (_distanceToNearestAvatar < _scale * SLOW_NEAR_RADIUS) {
|
||||||
linearDamping *= 1.f + AVATAR_DAMPING_FACTOR * (PERIPERSONAL_RADIUS - _distanceToNearestAvatar);
|
linearDamping *= 1.f + NEAR_AVATAR_DAMPING_FACTOR *
|
||||||
|
((SLOW_NEAR_RADIUS - _distanceToNearestAvatar) / SLOW_NEAR_RADIUS);
|
||||||
}
|
}
|
||||||
if (_speedBrakes) {
|
if (_speedBrakes) {
|
||||||
applyDamping(deltaTime, _velocity, linearDamping * SPEED_BRAKE_POWER, SQUARED_DAMPING_STRENGTH * SPEED_BRAKE_POWER);
|
applyDamping(deltaTime, _velocity, linearDamping * SPEED_BRAKE_POWER, SQUARED_DAMPING_STRENGTH * SPEED_BRAKE_POWER);
|
||||||
|
|
Loading…
Reference in a new issue