mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:17:01 +02:00
increased YAW_MAG (faster turning), redesigned the concept of avatar position, and reset Eve's position accordingly. Also added _frustumNeedsReshape in camera in anticipation of fixing problem where setting fov doesn't reshape the frustum.
This commit is contained in:
parent
9a4d27c0b5
commit
5a0a1c1cec
6 changed files with 70 additions and 41 deletions
|
@ -113,9 +113,8 @@ int main(int argc, const char* argv[]) {
|
||||||
// move eve away from the origin
|
// move eve away from the origin
|
||||||
// pick a random point inside a 10x10 grid
|
// pick a random point inside a 10x10 grid
|
||||||
|
|
||||||
eve.setPosition(glm::vec3(randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION),
|
eve.setPosition(glm::vec3(randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION), 0.4,
|
||||||
0,
|
randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION)));
|
||||||
randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION)));
|
|
||||||
|
|
||||||
// face any instance of eve down the z-axis
|
// face any instance of eve down the z-axis
|
||||||
eve.setBodyYaw(0);
|
eve.setBodyYaw(0);
|
||||||
|
|
|
@ -59,8 +59,7 @@ Avatar::Avatar(bool isMine) {
|
||||||
//_transmitterTimer = 0;
|
//_transmitterTimer = 0;
|
||||||
_transmitterHz = 0.0;
|
_transmitterHz = 0.0;
|
||||||
_transmitterPackets = 0;
|
_transmitterPackets = 0;
|
||||||
|
_pelvisStandingHeight = 0.0f;
|
||||||
initializeSkeleton();
|
|
||||||
|
|
||||||
_TEST_bigSphereRadius = 0.3f;
|
_TEST_bigSphereRadius = 0.3f;
|
||||||
_TEST_bigSpherePosition = glm::vec3( 0.0f, _TEST_bigSphereRadius, 2.0f );
|
_TEST_bigSpherePosition = glm::vec3( 0.0f, _TEST_bigSphereRadius, 2.0f );
|
||||||
|
@ -117,6 +116,8 @@ Avatar::Avatar(bool isMine) {
|
||||||
_handHolding.velocity = glm::vec3( 0.0, 0.0, 0.0 );
|
_handHolding.velocity = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
_handHolding.force = 10.0f;
|
_handHolding.force = 10.0f;
|
||||||
|
|
||||||
|
initializeSkeleton();
|
||||||
|
|
||||||
if (iris_texture.size() == 0) {
|
if (iris_texture.size() == 0) {
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
||||||
|
@ -127,7 +128,6 @@ Avatar::Avatar(bool isMine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Avatar::Avatar(const Avatar &otherAvatar) {
|
Avatar::Avatar(const Avatar &otherAvatar) {
|
||||||
|
|
||||||
_velocity = otherAvatar._velocity;
|
_velocity = otherAvatar._velocity;
|
||||||
|
@ -156,8 +156,6 @@ Avatar::Avatar(const Avatar &otherAvatar) {
|
||||||
_orientation.set( otherAvatar._orientation );
|
_orientation.set( otherAvatar._orientation );
|
||||||
|
|
||||||
_sphere = NULL;
|
_sphere = NULL;
|
||||||
|
|
||||||
initializeSkeleton();
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i];
|
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i];
|
||||||
|
|
||||||
|
@ -198,6 +196,9 @@ Avatar::Avatar(const Avatar &otherAvatar) {
|
||||||
_head.browAudioLift = otherAvatar._head.browAudioLift;
|
_head.browAudioLift = otherAvatar._head.browAudioLift;
|
||||||
_head.noise = otherAvatar._head.noise;
|
_head.noise = otherAvatar._head.noise;
|
||||||
|
|
||||||
|
|
||||||
|
initializeSkeleton();
|
||||||
|
|
||||||
if (iris_texture.size() == 0) {
|
if (iris_texture.size() == 0) {
|
||||||
switchToResourcesParentIfRequired();
|
switchToResourcesParentIfRequired();
|
||||||
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
||||||
|
@ -315,7 +316,7 @@ void Avatar::simulate(float deltaTime) {
|
||||||
// check for collisions with other avatars and respond
|
// check for collisions with other avatars and respond
|
||||||
updateAvatarCollisionDetectionAndResponse
|
updateAvatarCollisionDetectionAndResponse
|
||||||
(
|
(
|
||||||
otherAvatar->getBonePosition( AVATAR_BONE_PELVIS_SPINE ),
|
otherAvatar->getPosition(),
|
||||||
0.1,
|
0.1,
|
||||||
0.1,
|
0.1,
|
||||||
otherAvatar->getBodyUpDirection(),
|
otherAvatar->getBodyUpDirection(),
|
||||||
|
@ -327,7 +328,7 @@ void Avatar::simulate(float deltaTime) {
|
||||||
v -= otherAvatar->getBonePosition( AVATAR_BONE_RIGHT_HAND );
|
v -= otherAvatar->getBonePosition( AVATAR_BONE_RIGHT_HAND );
|
||||||
|
|
||||||
float distance = glm::length( v );
|
float distance = glm::length( v );
|
||||||
if ( distance < _maxArmLength ) {
|
if ( distance < _maxArmLength + _maxArmLength ) {
|
||||||
|
|
||||||
//if ( distance < closestDistance ) { // perhaps I don't need this if we want to allow multi-avatar interactions
|
//if ( distance < closestDistance ) { // perhaps I don't need this if we want to allow multi-avatar interactions
|
||||||
{
|
{
|
||||||
|
@ -376,6 +377,19 @@ void Avatar::simulate(float deltaTime) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( AVATAR_GRAVITY ) {
|
||||||
|
if ( _position.y > _pelvisStandingHeight + 0.01 ) {
|
||||||
|
_velocity += glm::dvec3( 0.0, -1.0, 0.0 ) * ( 6.0 * deltaTime );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( _position.y < _pelvisStandingHeight ) {
|
||||||
|
_position.y = _pelvisStandingHeight;
|
||||||
|
_velocity.y = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if ( AVATAR_GRAVITY ) {
|
if ( AVATAR_GRAVITY ) {
|
||||||
if ( _position.y > _bone[ AVATAR_BONE_RIGHT_FOOT ].radius * 2.0 ) {
|
if ( _position.y > _bone[ AVATAR_BONE_RIGHT_FOOT ].radius * 2.0 ) {
|
||||||
_velocity += glm::dvec3( 0.0, -1.0, 0.0 ) * ( 6.0 * deltaTime );
|
_velocity += glm::dvec3( 0.0, -1.0, 0.0 ) * ( 6.0 * deltaTime );
|
||||||
|
@ -387,6 +401,8 @@ void Avatar::simulate(float deltaTime) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// update body springs
|
// update body springs
|
||||||
updateBodySprings( deltaTime );
|
updateBodySprings( deltaTime );
|
||||||
|
@ -612,6 +628,7 @@ void Avatar::updateAvatarCollisionDetectionAndResponse
|
||||||
|
|
||||||
void Avatar::render(bool lookingInMirror) {
|
void Avatar::render(bool lookingInMirror) {
|
||||||
|
|
||||||
|
/*
|
||||||
// show avatar position
|
// show avatar position
|
||||||
glColor4f( 0.5f, 0.5f, 0.5f, 0.6 );
|
glColor4f( 0.5f, 0.5f, 0.5f, 0.6 );
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -619,6 +636,7 @@ void Avatar::render(bool lookingInMirror) {
|
||||||
glScalef( 0.03, 0.03, 0.03 );
|
glScalef( 0.03, 0.03, 0.03 );
|
||||||
glutSolidSphere( 1, 10, 10 );
|
glutSolidSphere( 1, 10, 10 );
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
*/
|
||||||
|
|
||||||
if ( usingBigSphereCollisionTest ) {
|
if ( usingBigSphereCollisionTest ) {
|
||||||
|
|
||||||
|
@ -884,7 +902,7 @@ void Avatar::initializeSkeleton() {
|
||||||
_bone[ AVATAR_BONE_RIGHT_FOOT ].parent = AVATAR_BONE_RIGHT_SHIN;
|
_bone[ AVATAR_BONE_RIGHT_FOOT ].parent = AVATAR_BONE_RIGHT_SHIN;
|
||||||
|
|
||||||
// specify the default pose position
|
// specify the default pose position
|
||||||
_bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.3, 0.0 );
|
_bone[ AVATAR_BONE_PELVIS_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
_bone[ AVATAR_BONE_MID_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 );
|
_bone[ AVATAR_BONE_MID_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.1, 0.0 );
|
||||||
_bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
_bone[ AVATAR_BONE_CHEST_SPINE ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
||||||
_bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
_bone[ AVATAR_BONE_NECK ].defaultPosePosition = glm::vec3( 0.0, 0.06, 0.0 );
|
||||||
|
@ -907,8 +925,7 @@ void Avatar::initializeSkeleton() {
|
||||||
_bone[ AVATAR_BONE_RIGHT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
_bone[ AVATAR_BONE_RIGHT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||||
_bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
_bone[ AVATAR_BONE_RIGHT_SHIN ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
|
||||||
_bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 );
|
_bone[ AVATAR_BONE_RIGHT_FOOT ].defaultPosePosition = glm::vec3( 0.0, 0.0, 0.04 );
|
||||||
|
|
||||||
|
|
||||||
_bone[ AVATAR_BONE_PELVIS_SPINE ].radius = 0.05;
|
_bone[ AVATAR_BONE_PELVIS_SPINE ].radius = 0.05;
|
||||||
_bone[ AVATAR_BONE_MID_SPINE ].radius = 0.06;
|
_bone[ AVATAR_BONE_MID_SPINE ].radius = 0.06;
|
||||||
_bone[ AVATAR_BONE_CHEST_SPINE ].radius = 0.03;
|
_bone[ AVATAR_BONE_CHEST_SPINE ].radius = 0.03;
|
||||||
|
@ -935,6 +952,13 @@ void Avatar::initializeSkeleton() {
|
||||||
|
|
||||||
// calculate bone length
|
// calculate bone length
|
||||||
calculateBoneLengths();
|
calculateBoneLengths();
|
||||||
|
|
||||||
|
_pelvisStandingHeight =
|
||||||
|
_bone[ AVATAR_BONE_PELVIS_SPINE ].length +
|
||||||
|
_bone[ AVATAR_BONE_LEFT_THIGH ].length +
|
||||||
|
_bone[ AVATAR_BONE_LEFT_SHIN ].length +
|
||||||
|
_bone[ AVATAR_BONE_LEFT_FOOT ].length +
|
||||||
|
_bone[ AVATAR_BONE_RIGHT_FOOT ].radius;
|
||||||
|
|
||||||
// generate world positions
|
// generate world positions
|
||||||
updateSkeleton();
|
updateSkeleton();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
const bool AVATAR_GRAVITY = true;
|
const bool AVATAR_GRAVITY = true;
|
||||||
const float DECAY = 0.1;
|
const float DECAY = 0.1;
|
||||||
const float THRUST_MAG = 10.0;
|
const float THRUST_MAG = 10.0;
|
||||||
const float YAW_MAG = 300.0;
|
const float YAW_MAG = 500.0; //JJV - changed from 300.0;
|
||||||
const float TEST_YAW_DECAY = 5.0;
|
const float TEST_YAW_DECAY = 5.0;
|
||||||
const float LIN_VEL_DECAY = 5.0;
|
const float LIN_VEL_DECAY = 5.0;
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ class Avatar : public AvatarData {
|
||||||
int _transmitterPackets;
|
int _transmitterPackets;
|
||||||
Avatar* _interactingOther;
|
Avatar* _interactingOther;
|
||||||
bool _interactingOtherIsNearby;
|
bool _interactingOtherIsNearby;
|
||||||
|
float _pelvisStandingHeight;
|
||||||
|
|
||||||
// private methods...
|
// private methods...
|
||||||
void initializeSkeleton();
|
void initializeSkeleton();
|
||||||
|
|
|
@ -11,21 +11,22 @@
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
|
||||||
Camera::Camera() {
|
Camera::Camera() {
|
||||||
_mode = CAMERA_MODE_THIRD_PERSON;
|
_frustumNeedsReshape = false;
|
||||||
_tightness = 10.0; // default
|
_mode = CAMERA_MODE_THIRD_PERSON;
|
||||||
_fieldOfView = 60.0; // default
|
_tightness = 10.0; // default
|
||||||
_nearClip = 0.08; // default
|
_fieldOfView = 60.0; // default
|
||||||
_farClip = 50.0; // default
|
_nearClip = 0.08; // default
|
||||||
_yaw = 0.0;
|
_farClip = 50.0; // default
|
||||||
_pitch = 0.0;
|
_yaw = 0.0;
|
||||||
_roll = 0.0;
|
_pitch = 0.0;
|
||||||
_upShift = 0.0;
|
_roll = 0.0;
|
||||||
_rightShift = 0.0;
|
_upShift = 0.0;
|
||||||
_distance = 0.0;
|
_rightShift = 0.0;
|
||||||
_idealYaw = 0.0;
|
_distance = 0.0;
|
||||||
_targetPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
_idealYaw = 0.0;
|
||||||
_position = glm::vec3( 0.0, 0.0, 0.0 );
|
_targetPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
_idealPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
_position = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
|
_idealPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
_orientation.setToIdentity();
|
_orientation.setToIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,10 @@ public:
|
||||||
void setPosition ( glm::vec3 p ) { _position = p; }
|
void setPosition ( glm::vec3 p ) { _position = p; }
|
||||||
void setOrientation ( Orientation o ) { _orientation.set(o); }
|
void setOrientation ( Orientation o ) { _orientation.set(o); }
|
||||||
void setTightness ( float t ) { _tightness = t; }
|
void setTightness ( float t ) { _tightness = t; }
|
||||||
void setFieldOfView ( float f ) { _fieldOfView = f; }
|
void setFieldOfView ( float f ) { _fieldOfView = f; _frustumNeedsReshape = true; }
|
||||||
void setAspectRatio ( float a ) { _aspectRatio = a; }
|
void setAspectRatio ( float a ) { _aspectRatio = a; _frustumNeedsReshape = true; }
|
||||||
void setNearClip ( float n ) { _nearClip = n; }
|
void setNearClip ( float n ) { _nearClip = n; _frustumNeedsReshape = true; }
|
||||||
void setFarClip ( float f ) { _farClip = f; }
|
void setFarClip ( float f ) { _farClip = f; _frustumNeedsReshape = true; }
|
||||||
|
|
||||||
float getYaw () { return _yaw; }
|
float getYaw () { return _yaw; }
|
||||||
float getPitch () { return _pitch; }
|
float getPitch () { return _pitch; }
|
||||||
|
@ -57,6 +57,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
bool _frustumNeedsReshape;
|
||||||
CameraMode _mode;
|
CameraMode _mode;
|
||||||
glm::vec3 _position;
|
glm::vec3 _position;
|
||||||
glm::vec3 _idealPosition;
|
glm::vec3 _idealPosition;
|
||||||
|
|
|
@ -810,6 +810,7 @@ void display(void)
|
||||||
myCamera.setUpShift ( 0.0 );
|
myCamera.setUpShift ( 0.0 );
|
||||||
myCamera.setDistance ( 0.2 );
|
myCamera.setDistance ( 0.2 );
|
||||||
myCamera.setTightness ( 100.0f );
|
myCamera.setTightness ( 100.0f );
|
||||||
|
myCamera.setFieldOfView ( 60.0f ); //this doesn't seem to be doing anything?
|
||||||
myCamera.update ( 1.f/FPS );
|
myCamera.update ( 1.f/FPS );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -817,15 +818,17 @@ void display(void)
|
||||||
bool firstPerson = false;
|
bool firstPerson = false;
|
||||||
|
|
||||||
if ( firstPerson ) {
|
if ( firstPerson ) {
|
||||||
myCamera.setPitch (15.0f ); // temporarily, this must be 0.0 or else bad juju
|
myCamera.setPitch (15.0f ); // temporarily, this must be 0.0 or else bad juju
|
||||||
myCamera.setUpShift (0.0f );
|
myCamera.setUpShift (0.0f );
|
||||||
myCamera.setDistance (0.0f );
|
myCamera.setDistance (0.0f );
|
||||||
myCamera.setTightness (100.0f);
|
myCamera.setTightness (100.0f);
|
||||||
|
myCamera.setFieldOfView(60.0f ); //this doesn't seem to be doing anything?
|
||||||
} else {
|
} else {
|
||||||
myCamera.setPitch (0.0f ); // temporarily, this must be 0.0 or else bad juju
|
myCamera.setPitch (0.0f ); // temporarily, this must be 0.0 or else bad juju
|
||||||
myCamera.setUpShift (-0.1f);
|
myCamera.setUpShift (-0.1f);
|
||||||
myCamera.setDistance (1.0f );
|
myCamera.setDistance (1.0f );
|
||||||
myCamera.setTightness (8.0f );
|
myCamera.setTightness (8.0f );
|
||||||
|
myCamera.setFieldOfView(60.0f); //this doesn't seem to be doing anything?
|
||||||
}
|
}
|
||||||
|
|
||||||
myCamera.setTargetPosition( myAvatar.getHeadPosition() );
|
myCamera.setTargetPosition( myAvatar.getHeadPosition() );
|
||||||
|
|
Loading…
Reference in a new issue