mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 16:20:11 +02:00
Third person camera transition doesn't happen on movement.
This commit is contained in:
parent
6cd25294b4
commit
27266ee3b2
4 changed files with 23 additions and 11 deletions
|
@ -1504,7 +1504,7 @@ void Application::init() {
|
|||
|
||||
_myAvatar.init();
|
||||
_myAvatar.setPosition(START_LOCATION);
|
||||
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
_myCamera.setModeShiftRate(1.0f);
|
||||
_myAvatar.setDisplayingLookatVectors(false);
|
||||
|
||||
|
@ -1732,7 +1732,7 @@ void Application::update(float deltaTime) {
|
|||
_myCamera.setModeShiftRate(1.0f);
|
||||
}
|
||||
} else {
|
||||
const float THIRD_PERSON_SHIFT_VELOCITY = 2.0f;
|
||||
const float THIRD_PERSON_SHIFT_VELOCITY = 1000.0f;
|
||||
const float TIME_BEFORE_SHIFT_INTO_FIRST_PERSON = 0.75f;
|
||||
const float TIME_BEFORE_SHIFT_INTO_THIRD_PERSON = 0.1f;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
#include <portaudio.h>
|
||||
|
||||
#include <speex/speex_echo.h>
|
||||
#include <speex/speex_preprocess.h>
|
||||
//#include <speex/speex_echo.h>
|
||||
//#include <speex/speex_preprocess.h>
|
||||
|
||||
#include <AudioRingBuffer.h>
|
||||
#include <StdDev.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
const bool BALLS_ON = false;
|
||||
const bool BALLS_ON = true;
|
||||
const bool USING_AVATAR_GRAVITY = true;
|
||||
const glm::vec3 DEFAULT_UP_DIRECTION (0.0f, 1.0f, 0.0f);
|
||||
const float YAW_MAG = 500.0;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "world.h"
|
||||
|
||||
const float INITIAL_AREA = 0.2f;
|
||||
const float BALL_RADIUS = 0.025f;
|
||||
const float BALL_RADIUS = 0.016f;
|
||||
const glm::vec3 INITIAL_COLOR(0.62f, 0.74f, 0.91f);
|
||||
|
||||
Balls::Balls(int numberOfBalls) {
|
||||
|
@ -83,8 +83,9 @@ void Balls::render() {
|
|||
}
|
||||
|
||||
const float CONSTANT_VELOCITY_DAMPING = 1.0f;
|
||||
const float NOISE_SCALE = 0.00;
|
||||
const float SPRING_FORCE = 1.0;
|
||||
const float NOISE_SCALE = 0.06;
|
||||
const float SPRING_FORCE = 30.0;
|
||||
const float ORIGIN_DISTANCE = 0.1;
|
||||
const float SPRING_DAMPING = 1.0;
|
||||
|
||||
void Balls::simulate(float deltaTime) {
|
||||
|
@ -100,10 +101,21 @@ void Balls::simulate(float deltaTime) {
|
|||
// Add noise
|
||||
_balls[i].velocity += randVector() * NOISE_SCALE;
|
||||
|
||||
// spring force to origin
|
||||
float separation = glm::distance(_balls[i].position,
|
||||
_origin);
|
||||
|
||||
_balls[i].velocity +=
|
||||
glm::normalize(_balls[i].position - _origin)
|
||||
* deltaTime
|
||||
*
|
||||
SPRING_FORCE *
|
||||
(ORIGIN_DISTANCE - separation);
|
||||
|
||||
// Approach target position
|
||||
for (unsigned int i = 0; i < _numberOfBalls; ++i) {
|
||||
_balls[i].position += randFloat() * deltaTime * (_balls[i].targetPosition - _balls[i].position);
|
||||
}
|
||||
// for (unsigned int i = 0; i < _numberOfBalls; ++i) {
|
||||
// _balls[i].position += randFloat() * deltaTime * (_balls[i].targetPosition - _balls[i].position);
|
||||
// }
|
||||
|
||||
// Spring Force
|
||||
|
||||
|
|
Loading…
Reference in a new issue