generated from AfonsoCMSousa/CPP-OpenGLTemplate
feat: COLISIONS AND RADIUS INCLUDED
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define G_CONSTANT 0.65f
|
||||
#define G_CONSTANT 1.98f
|
||||
|
||||
typedef struct {
|
||||
float x, y, z;
|
||||
@@ -169,8 +169,8 @@ void *t_update(void *args) {
|
||||
p.position.y += p.velocity.y * params->time;
|
||||
p.position.z += p.velocity.z * params->time;
|
||||
|
||||
if (p.position.y <= 0) {
|
||||
p.position.y = 0;
|
||||
if (p.position.y <= 0 + p.radius) {
|
||||
p.position.y = 0 + p.radius;
|
||||
p.velocity.y *= (-1 * p.dampening);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user