use new space box trigonometric functions

This commit is contained in:
frank 2022-06-19 23:28:27 -04:00
parent 6e958debf0
commit c55bcd0ee8
4 changed files with 6 additions and 4 deletions

2
lib/sb

@ -1 +1 @@
Subproject commit 3444afc2c1291814d97efb94ca8aecb6e6698c40
Subproject commit 7e31b5a1c00f38dbd9d667f7e4174a5341ac550f

View File

@ -1,4 +1,4 @@
/* Cuckoo by @ohsqueezy [ohsqueezy.itch.io] */
/* Pepy by @ohsqueezy [ohsqueezy.itch.io] */
#include "Model.hpp"

View File

@ -245,11 +245,12 @@ void Pepy::update()
float distance = glm::distance(ball_center, cuckoo_center);
if (shaking)
{
/* The ball will bounce back toward the center of the cuckoo if it's a certain distance away from it. */
if (distance > 0.65f)
{
float angle = glm::atan(cuckoo_center.y - ball_center.y, cuckoo_center.x - ball_center.x);
/* Calculate the angle of the ball and add speed. */
ball.second.x = sb::angle_between(ball_center, cuckoo_center);
ball.second.y += 0.0005f;
ball.second.x = angle + glm::half_pi<float>();
}
}
glm::vec2 step = sb::velocity_to_delta(ball.second);

View File

@ -69,6 +69,7 @@ private:
float hue_offset = 0.0f, time_seconds = 0.0f, aspect_ratio = 1.0f, return_speed = 0.0075f, cuckoo_speed = 0.0f, countdown = 10.0f;
glm::mat4 orthographic_projection {1};
glm::vec3 cuckoo_offset {0.0f, 0.0f, 0.0f};
glm::vec2 cuckoo_velocity {0.0f, 0.0f};
bool grabbed = false;
glm::ivec2 mouse_pixel = {0, 0};
Plane background;