Orbbit - Duck Sauce Games 2024
Physics based puzzles, launch a green satellite with an initial velocity and watch as it is affected by and affect how a solar system moves. The goal is to have the satellite dock with the red planet present in each level.
Made in 48 Hours for Duck Sauce Games Jam 2024 Using my graphics library built in C++ with Vulkan and OpenGL rendering backends.
Camera Tracking
The camera orbits a planet and tracks the movement of a different target planet. When the camera is on the green satellite it is focused on the nearest planet. Otherwise the camera tracks the green satellite when it is on any other planet. Here is the code that handles that.
vec3 camForward(0); // ideal cam forward
if(target == player)
camForward = target.pos - nearest.pos; // point cam to nearest planet
else
camForward = target.pos - player.pos; // point cam to player
// have the camera raised up a bit so cam looks down on target slightly
camForward += vec3(0, 0, 0.4)*length(camForward);
// interpolate camera towards calculated forward
float diff = 0.00005f*dt;
cam.setForward(camFoward*diff + (1-diff)*cam.getForward());