mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 09:24:06 +02:00
- Change collision radius according to near clip so nothing comes inside
This commit is contained in:
parent
19b9be3361
commit
35557e1973
2 changed files with 9 additions and 2 deletions
|
@ -131,6 +131,8 @@ Avatar::Avatar(Node* owningNode) :
|
||||||
} else {
|
} else {
|
||||||
_balls = NULL;
|
_balls = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_collisionRadius = _height * 0.125f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -978,7 +980,7 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d
|
||||||
|
|
||||||
void Avatar::updateCollisionWithEnvironment(float deltaTime) {
|
void Avatar::updateCollisionWithEnvironment(float deltaTime) {
|
||||||
glm::vec3 up = getBodyUpDirection();
|
glm::vec3 up = getBodyUpDirection();
|
||||||
float radius = _height * 0.125f;
|
float radius = _collisionRadius;
|
||||||
const float ENVIRONMENT_SURFACE_ELASTICITY = 1.0f;
|
const float ENVIRONMENT_SURFACE_ELASTICITY = 1.0f;
|
||||||
const float ENVIRONMENT_SURFACE_DAMPING = 0.01;
|
const float ENVIRONMENT_SURFACE_DAMPING = 0.01;
|
||||||
const float ENVIRONMENT_COLLISION_FREQUENCY = 0.05f;
|
const float ENVIRONMENT_COLLISION_FREQUENCY = 0.05f;
|
||||||
|
@ -994,7 +996,7 @@ void Avatar::updateCollisionWithEnvironment(float deltaTime) {
|
||||||
|
|
||||||
|
|
||||||
void Avatar::updateCollisionWithVoxels(float deltaTime) {
|
void Avatar::updateCollisionWithVoxels(float deltaTime) {
|
||||||
float radius = _height * 0.125f;
|
float radius = _collisionRadius;
|
||||||
const float VOXEL_ELASTICITY = 1.4f;
|
const float VOXEL_ELASTICITY = 1.4f;
|
||||||
const float VOXEL_DAMPING = 0.0;
|
const float VOXEL_DAMPING = 0.0;
|
||||||
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
||||||
|
@ -1643,5 +1645,9 @@ void Avatar::setScale(const float scale) {
|
||||||
_pelvisFloatingHeight = _skeleton.getPelvisFloatingHeight() + _bodyBall[ BODY_BALL_LEFT_HEEL ].radius;
|
_pelvisFloatingHeight = _skeleton.getPelvisFloatingHeight() + _bodyBall[ BODY_BALL_LEFT_HEEL ].radius;
|
||||||
_pelvisToHeadLength = _skeleton.getPelvisToHeadLength();
|
_pelvisToHeadLength = _skeleton.getPelvisToHeadLength();
|
||||||
_avatarTouch.setReachableRadius(_scale * PERIPERSONAL_RADIUS);
|
_avatarTouch.setReachableRadius(_scale * PERIPERSONAL_RADIUS);
|
||||||
|
|
||||||
|
Camera* myCamera = Application::getInstance()->getCamera();
|
||||||
|
_collisionRadius = myCamera->getAspectRatio() * (myCamera->getNearClip() / cos(myCamera->getFieldOfView() / 2.f));
|
||||||
|
_collisionRadius *= COLLISION_RADIUS_SCALAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,7 @@ private:
|
||||||
bool _speedBrakes;
|
bool _speedBrakes;
|
||||||
bool _isThrustOn;
|
bool _isThrustOn;
|
||||||
bool _isCollisionsOn;
|
bool _isCollisionsOn;
|
||||||
|
float _collisionRadius;
|
||||||
|
|
||||||
Avatar* _leadingAvatar;
|
Avatar* _leadingAvatar;
|
||||||
float _stringLength;
|
float _stringLength;
|
||||||
|
|
Loading…
Reference in a new issue