Camera tracks center
This commit is contained in:
parent
77a4939cce
commit
3f10426679
@ -1,3 +1,3 @@
|
||||
0.1
|
||||
150
|
||||
0.01
|
||||
200
|
||||
0
|
||||
|
@ -412,8 +412,9 @@ int main() {
|
||||
std::clock_t prevClock = startTime;
|
||||
bool pushframe = false;
|
||||
|
||||
// Camera will be centered on this star
|
||||
int trackedStar = 0;
|
||||
// Camera will be centered on these stars
|
||||
int trackedStarA = 0;
|
||||
int trackedStarB = 1;
|
||||
|
||||
// Initialize the camera position
|
||||
Vector3 cameraPosition = Vector3(0,0,0);
|
||||
@ -499,7 +500,7 @@ int main() {
|
||||
}
|
||||
|
||||
// New position
|
||||
cameraPosition = stars[trackedStar].position;
|
||||
cameraPosition = (stars[trackedStarA].position + stars[trackedStarB].position)/2;
|
||||
|
||||
// Pushes the frame
|
||||
SDL_RenderPresent(renderer);
|
||||
@ -546,7 +547,8 @@ int main() {
|
||||
playing = !playing;
|
||||
break;
|
||||
case SDLK_RETURN:
|
||||
trackedStar = rand() % starCount;
|
||||
trackedStarA = rand() % starCount;
|
||||
trackedStarB = trackedStarA;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user