Ajout de l'intégration simple (Euler explicite)
This commit is contained in:
		
							parent
							
								
									382cc27eb3
								
							
						
					
					
						commit
						3df200091b
					
				|  | @ -1,9 +1,9 @@ | ||||||
| #include "physics_object.hpp" | #include "physics_object.hpp" | ||||||
| 
 | 
 | ||||||
| void PhysicsObject::update(State state) { | void PhysicsObject::update(State state) { | ||||||
|     sf::Vector2f forces = getForces(state); |     sf::Vector2f acceleration = getForces(state) / mass; | ||||||
| 
 |     velocity += acceleration * state.delta; | ||||||
|     // TODO: intégrer le vecteur force dans la vitesse puis la position
 |     position += velocity * state.delta; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| sf::Vector2f PhysicsObject::getVelocity() { | sf::Vector2f PhysicsObject::getVelocity() { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue