direction normalization, target -> direction

This commit is contained in:
huaqo-games
2025-03-19 17:27:31 +01:00
parent 9920239f55
commit f9fea0e613
2 changed files with 3 additions and 8 deletions
-5
View File
@@ -1,5 +0,0 @@
{
"files.associations": {
"menu.h": "c"
}
}
+3 -3
View File
@@ -9,7 +9,7 @@ typedef struct {
} Physics;
void UpdatePhysicsDirection(Vector2 *direction, Vector2 vector){
*direction = vector;
*direction = Vector2Normalize(vector);
}
void UpdatePhysicsVelocity(Vector2 *velocity, Vector2 *direction, float *speed){
@@ -24,8 +24,8 @@ void UpdatePhysicsSpeed(float *speed, float *newSpeed){
*speed = *newSpeed;
}
void UpdatePhysics(Physics *physics, Vector2 target){
UpdatePhysicsDirection(&physics->direction, target);
void UpdatePhysics(Physics *physics, Vector2 direction){
UpdatePhysicsDirection(&physics->direction, direction);
UpdatePhysicsVelocity(&physics->velocity, &physics->direction, &physics->speed);
UpdatePhysicsPosition(&physics->position, &physics->velocity);
}