History

made a different prototype for camera shifting into first-person

Jeffrey Ventrella committed 13 years ago

Commit adccd621 parent 2486b6e3 files · +91 −64Browse files

Showing the changes to interface/src/main.cpp (1 of 3 files). Show all

Unified · Split

interface/src/main.cpp+42−6
@@ -102,7 +102,7 @@ int HEIGHT = 800; · 101 unmodified lines
102102 int fullscreen = 0;
103103 float aspectRatio = 1.0f;
104104
105−bool USING_FIRST_PERSON_EFFECT = false;
105+bool USING_FIRST_PERSON_EFFECT = true;
106106
107107 bool wantColorRandomizer = true; // for addSphere and load file
108108
@@ -738,9 +738,14 @@ void display(void) · 629 unmodified lines
738738 myCamera.setTightness ( 100.0f );
739739 } else {
740740
741+ //float firstPersonPitch = 20.0f;
742+ //float firstPersonUpShift = 0.0f;
743+ //float firstPersonDistance = 0.0f;
744+ //float firstPersonTightness = 100.0f;
745+
741746 float firstPersonPitch = 20.0f;
742747 float firstPersonUpShift = 0.1f;
743− float firstPersonDistance = 0.0f;
748+ float firstPersonDistance = 0.4f;
744749 float firstPersonTightness = 100.0f;
745750
746751 float thirdPersonPitch = 0.0f;
@@ -749,14 +754,44 @@ void display(void) · 2 unmodified lines
749754 float thirdPersonTightness = 8.0f;
750755
751756 if ( USING_FIRST_PERSON_EFFECT ) {
757+ float ff = 0.0;
758+ float min = 0.1;
759+ float max = 0.5;
760+
761+ if ( myAvatar.getIsNearInteractingOther()){
762+ if ( myAvatar.getSpeed() < max ) {
763+
764+ float s = (myAvatar.getSpeed()- min)/max ;
765+ ff = 1.0 - s;
766+ }
767+ }
768+
769+ /*
770+ if ( ff < 0.8 ) {
771+ myAvatar.setDisplayingHead( true );
772+ } else {
773+ myAvatar.setDisplayingHead( false );
774+ }
775+ */
776+
777+ //printf( "ff = %f\n", ff );
778+
779+ myCamera.setPitch ( thirdPersonPitch + ff * ( firstPersonPitch - thirdPersonPitch ));
780+ myCamera.setUpShift ( thirdPersonUpShift + ff * ( firstPersonUpShift - thirdPersonUpShift ));
781+ myCamera.setDistance ( thirdPersonDistance + ff * ( firstPersonDistance - thirdPersonDistance ));
782+ myCamera.setTightness ( thirdPersonTightness + ff * ( firstPersonTightness - thirdPersonTightness ));
783+
784+
785+
786+ // this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view
787+ /*
752788 if ( myAvatar.getSpeed() < 0.02 ) {
753789
754790 if (myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) {
755791 myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
756792 }
757793
758− printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift());
759−
794+ //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift());
760795 myCamera.setPitch ( thirdPersonPitch + myCamera.getModeShift() * ( firstPersonPitch - thirdPersonPitch ));
761796 myCamera.setUpShift ( thirdPersonUpShift + myCamera.getModeShift() * ( firstPersonUpShift - thirdPersonUpShift ));
762797 myCamera.setDistance ( thirdPersonDistance + myCamera.getModeShift() * ( firstPersonDistance - thirdPersonDistance ));
@@ -766,13 +801,14 @@ void display(void) · 3 unmodified lines
766801 myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
767802 }
768803
769− printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift());
770−
804+ //printf( "myCamera.getModeShift() = %f\n", myCamera.getModeShift());
771805 myCamera.setPitch ( firstPersonPitch + myCamera.getModeShift() * ( thirdPersonPitch - firstPersonPitch ));
772806 myCamera.setUpShift ( firstPersonUpShift + myCamera.getModeShift() * ( thirdPersonUpShift - firstPersonUpShift ));
773807 myCamera.setDistance ( firstPersonDistance + myCamera.getModeShift() * ( thirdPersonDistance - firstPersonDistance ));
774808 myCamera.setTightness ( firstPersonTightness + myCamera.getModeShift() * ( thirdPersonTightness - firstPersonTightness ));
775809 }
810+ */
811+
776812 } else {
777813 myCamera.setPitch (thirdPersonPitch );
778814 myCamera.setUpShift (thirdPersonUpShift );