direction normalization, target -> direction
This commit is contained in:
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"files.associations": {
|
|
||||||
"menu.h": "c"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ typedef struct {
|
|||||||
} Physics;
|
} Physics;
|
||||||
|
|
||||||
void UpdatePhysicsDirection(Vector2 *direction, Vector2 vector){
|
void UpdatePhysicsDirection(Vector2 *direction, Vector2 vector){
|
||||||
*direction = vector;
|
*direction = Vector2Normalize(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePhysicsVelocity(Vector2 *velocity, Vector2 *direction, float *speed){
|
void UpdatePhysicsVelocity(Vector2 *velocity, Vector2 *direction, float *speed){
|
||||||
@@ -24,8 +24,8 @@ void UpdatePhysicsSpeed(float *speed, float *newSpeed){
|
|||||||
*speed = *newSpeed;
|
*speed = *newSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePhysics(Physics *physics, Vector2 target){
|
void UpdatePhysics(Physics *physics, Vector2 direction){
|
||||||
UpdatePhysicsDirection(&physics->direction, target);
|
UpdatePhysicsDirection(&physics->direction, direction);
|
||||||
UpdatePhysicsVelocity(&physics->velocity, &physics->direction, &physics->speed);
|
UpdatePhysicsVelocity(&physics->velocity, &physics->direction, &physics->speed);
|
||||||
UpdatePhysicsPosition(&physics->position, &physics->velocity);
|
UpdatePhysicsPosition(&physics->position, &physics->velocity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user