mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Avatar resizing final commit
This commit is contained in:
parent
078a47b006
commit
bf3c4fa1f8
5 changed files with 17 additions and 17 deletions
|
@ -1183,21 +1183,21 @@ void Application::setRenderThirdPerson(bool thirdPerson) {
|
|||
}
|
||||
|
||||
void Application::increaseAvatarSize() {
|
||||
if (3.0f < _myAvatar.getScale() + 0.25f) {
|
||||
if (5.0f < _myAvatar.getScale() + 0.05f) {
|
||||
return;
|
||||
}
|
||||
|
||||
_myAvatar.setScale(_myAvatar.getScale() + 0.25f);
|
||||
_myCamera.setScale(_myAvatar.getScale() + 0.25f);
|
||||
_myAvatar.setScale(_myAvatar.getScale() + 0.05f);
|
||||
_myCamera.setScale(_myAvatar.getScale() + 0.05f);
|
||||
}
|
||||
|
||||
void Application::decreaseAvatarSize() {
|
||||
if (_myAvatar.getScale() + 0.25f < 0.25f) {
|
||||
if (_myAvatar.getScale() - 0.05f < 0.15f) {
|
||||
return;
|
||||
}
|
||||
|
||||
_myAvatar.setScale(_myAvatar.getScale() - 0.25f);
|
||||
_myCamera.setScale(_myAvatar.getScale() - 0.25f);
|
||||
_myAvatar.setScale(_myAvatar.getScale() - 0.05f);
|
||||
_myCamera.setScale(_myAvatar.getScale() - 0.05f);
|
||||
}
|
||||
|
||||
void Application::setFrustumOffset(bool frustumOffset) {
|
||||
|
|
|
@ -575,13 +575,13 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter) {
|
|||
_bodyYawDelta *= bodySpinMomentum;
|
||||
_bodyRollDelta *= bodySpinMomentum;
|
||||
|
||||
const float MAX_STATIC_FRICTION_VELOCITY = _scale * 0.5f;
|
||||
const float MAX_STATIC_FRICTION_VELOCITY = 0.5f;
|
||||
const float STATIC_FRICTION_STRENGTH = _scale * 20.f;
|
||||
applyStaticFriction(deltaTime, _velocity, MAX_STATIC_FRICTION_VELOCITY, STATIC_FRICTION_STRENGTH);
|
||||
|
||||
const float LINEAR_DAMPING_STRENGTH = 1.0f;
|
||||
const float SPEED_BRAKE_POWER = _scale * 10.0f;
|
||||
const float SQUARED_DAMPING_STRENGTH = _scale * 0.2f;
|
||||
const float SQUARED_DAMPING_STRENGTH = 0.2f;
|
||||
if (_speedBrakes) {
|
||||
applyDamping(deltaTime, _velocity, LINEAR_DAMPING_STRENGTH * SPEED_BRAKE_POWER, SQUARED_DAMPING_STRENGTH * SPEED_BRAKE_POWER);
|
||||
} else {
|
||||
|
|
|
@ -92,14 +92,14 @@ void Camera::updateFollowMode(float deltaTime) {
|
|||
|
||||
if (_needsToInitialize || (_tightness == 0.0f)) {
|
||||
_rotation = _targetRotation;
|
||||
_idealPosition = _targetPosition + _rotation * glm::vec3(0.0f, _upShift, _distance);
|
||||
_idealPosition = _targetPosition + _scale * (_rotation * glm::vec3(0.0f, _upShift, _distance));
|
||||
_position = _idealPosition;
|
||||
_needsToInitialize = false;
|
||||
|
||||
} else {
|
||||
// pull rotation towards ideal
|
||||
_rotation = safeMix(_rotation, _targetRotation, t);
|
||||
_idealPosition = _targetPosition + _rotation * glm::vec3(0.0f, _upShift, _distance);
|
||||
_idealPosition = _targetPosition + _scale * (_rotation * glm::vec3(0.0f, _upShift, _distance));
|
||||
_position += (_idealPosition - _position) * t;
|
||||
}
|
||||
}
|
||||
|
@ -124,18 +124,18 @@ void Camera::setMode(CameraMode m) {
|
|||
_previousTightness = _tightness;
|
||||
|
||||
if (_mode == CAMERA_MODE_THIRD_PERSON) {
|
||||
_newUpShift = _scale * CAMERA_THIRD_PERSON_MODE_UP_SHIFT;
|
||||
_newDistance = _scale * CAMERA_THIRD_PERSON_MODE_DISTANCE;
|
||||
_newUpShift = CAMERA_THIRD_PERSON_MODE_UP_SHIFT;
|
||||
_newDistance = CAMERA_THIRD_PERSON_MODE_DISTANCE;
|
||||
_newTightness = CAMERA_THIRD_PERSON_MODE_TIGHTNESS;
|
||||
|
||||
} else if (_mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
_newUpShift = _scale * CAMERA_FIRST_PERSON_MODE_UP_SHIFT;
|
||||
_newDistance = _scale * CAMERA_FIRST_PERSON_MODE_DISTANCE;
|
||||
_newUpShift = CAMERA_FIRST_PERSON_MODE_UP_SHIFT;
|
||||
_newDistance = CAMERA_FIRST_PERSON_MODE_DISTANCE;
|
||||
_newTightness = CAMERA_FIRST_PERSON_MODE_TIGHTNESS;
|
||||
|
||||
} else if (_mode == CAMERA_MODE_MIRROR) {
|
||||
_newUpShift = _scale * CAMERA_MIRROR_MODE_UP_SHIFT;
|
||||
_newDistance = _scale * CAMERA_MIRROR_MODE_DISTANCE;
|
||||
_newUpShift = CAMERA_MIRROR_MODE_UP_SHIFT;
|
||||
_newDistance = CAMERA_MIRROR_MODE_DISTANCE;
|
||||
_newTightness = CAMERA_MIRROR_MODE_TIGHTNESS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
float getFarClip () { return _scale * _farClip; }
|
||||
const glm::vec3& getEyeOffsetPosition () { return _eyeOffsetPosition; }
|
||||
const glm::quat& getEyeOffsetOrientation () { return _eyeOffsetOrientation; }
|
||||
float getScale () { return _scale; }
|
||||
|
||||
bool getFrustumNeedsReshape(); // call to find out if the view frustum needs to be reshaped
|
||||
void setFrustumWasReshaped(); // call this after reshaping the view frustum.
|
||||
|
|
|
@ -200,7 +200,6 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
|||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyPitch);
|
||||
sourceBuffer += unpackFloatAngleFromTwoByte((uint16_t*) sourceBuffer, &_bodyRoll);
|
||||
sourceBuffer += unpackFloatRatioFromTwoByte( sourceBuffer, _newScale);
|
||||
std::cout << "New Scale : " << _newScale << std::endl;
|
||||
|
||||
// Head rotation (NOTE: This needs to become a quaternion to save two bytes)
|
||||
float headYaw, headPitch, headRoll;
|
||||
|
|
Loading…
Reference in a new issue