cs381/as3
John Montagu, the 4th Earl of Sandvich c8574ac85e
Add camera movement
2026-02-22 22:45:41 -08:00
..
generated Add AS3 files 2026-02-22 20:03:58 -08:00
CMakeLists.txt Add AS3 files 2026-02-22 20:03:58 -08:00
README.md Add camera movement 2026-02-22 22:45:41 -08:00
as3.cpp Add camera movement 2026-02-22 22:45:41 -08:00
skybox.cpp Add AS3 files 2026-02-22 20:03:58 -08:00
skybox.hpp Add AS3 files 2026-02-22 20:03:58 -08:00

README.md

Building and Running

Clone the repository, navigate to the root of the project, and initialize the submodules:

git clone https://github.com/humanoidsandvichdispenser/cs381.git
cd cs381
git submodule update --init --recursive

Navigate to the as3 directory, create a build directory, and run CMake to generate the build files:

cd as3
mkdir -p build
cd build
cmake ..

Compile the code using make:

make

This should create an executable named as3 in the build directory. You can run the executable with the following command:

./as3

Instructions on how to use the program

Hold W and S to accelerate the penguin forward and backward. Use A and D to change heading direction. This allows you to steer the penguin around the environment.

Use the arrow keys to change the camera's rotation (pitch and yaw) with respect to the penguin, allowing you to look around while the penguin moves.

Readme Question

dt is delta time, which is the time elapsed between each frame, which can be found by taking the current time and subtracting the time from the previous frame. Raylib provides a function GetFrameTime() that returns the time elapsed since the last frame, which can be used to calculate dt. By using dt, it ensures that physics calculations are independent of frame rate, since otherwise the velocity would be in terms of units per frame rather than units per second. By multiplying the velocity by dt, it converts the velocity to units per second, allowing for consistent movement regardless of the frame rate.

Extra Credit

The camera moves with the penguin and can be rotated around the penguin using the arrow keys.