mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Merge pull request #816 from Atlante45/master
Fix objects coming into near clip
This commit is contained in:
commit
153e8afd44
3 changed files with 11 additions and 2 deletions
|
@ -1389,6 +1389,8 @@ void Application::setRenderFirstPerson(bool firstPerson) {
|
||||||
if (firstPerson) {
|
if (firstPerson) {
|
||||||
_lookingInMirror->setChecked(false);
|
_lookingInMirror->setChecked(false);
|
||||||
_manualThirdPerson->setChecked(false);
|
_manualThirdPerson->setChecked(false);
|
||||||
|
} else {
|
||||||
|
_manualThirdPerson->trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ Avatar::Avatar(Node* owningNode) :
|
||||||
} else {
|
} else {
|
||||||
_balls = NULL;
|
_balls = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_collisionRadius = _height * 0.125f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -634,6 +636,10 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter, float gyroCamer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isCollisionsOn) {
|
if (_isCollisionsOn) {
|
||||||
|
Camera* myCamera = Application::getInstance()->getCamera();
|
||||||
|
_collisionRadius = myCamera->getAspectRatio() * (myCamera->getNearClip() / cos(myCamera->getFieldOfView() / 2.f));
|
||||||
|
_collisionRadius *= COLLISION_RADIUS_SCALAR;
|
||||||
|
|
||||||
updateCollisionWithEnvironment(deltaTime);
|
updateCollisionWithEnvironment(deltaTime);
|
||||||
updateCollisionWithVoxels(deltaTime);
|
updateCollisionWithVoxels(deltaTime);
|
||||||
updateAvatarCollisions(deltaTime);
|
updateAvatarCollisions(deltaTime);
|
||||||
|
@ -978,7 +984,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 +1000,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;
|
||||||
|
|
|
@ -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