From: Patrik Gornicz Date: Fri, 22 Aug 2008 16:48:09 +0000 (-0400) Subject: gravity corrected, mass changed to 5 for start balls X-Git-Tag: physics-premerge~130 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=commitdiff_plain;h=e89e708a1a18f768b3db28c99fabdcf91f6bce63;p=libbear.git gravity corrected, mass changed to 5 for start balls --- diff --git a/src/Effects/Gravity.cpp b/src/Effects/Gravity.cpp index 85fd46c..3be7560 100644 --- a/src/Effects/Gravity.cpp +++ b/src/Effects/Gravity.cpp @@ -17,6 +17,11 @@ #include "Gravity.h" +#include "../Entities/PhysicsEntity.h" + +/// ***** Private Variables ***** + +float forceGravity = 0.001; /// ***** Constructors/Destructors ***** @@ -31,7 +36,7 @@ Gravity::~Gravity() /// ***** Public Class Methods ***** -Vector2 Gravity::forceDelta(const PhysicsEntity*, float) const +Vector2 Gravity::forceDelta(const PhysicsEntity* e, float) const { - return Vector2(0, 0.001); + return Vector2(0, e->mass * forceGravity); } diff --git a/src/entityCreator.cpp b/src/entityCreator.cpp index c015136..fa16ae2 100644 --- a/src/entityCreator.cpp +++ b/src/entityCreator.cpp @@ -48,30 +48,31 @@ void removeAllBalls(queBall& que); void creator::init() { Ball* ball; + float startMass = 5; ball = addBall(Vector2(50, 50), 20, cWhite, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(150, 50), 20, cGrey, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(50, 100), 20, cRed, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(100, 100), 20, cGreen, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(150, 100), 20, cBlue, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(50, 150), 20, cYellow, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(100, 150), 20, cMagenta, startBalls); - ball->mass = 10; + ball->mass = startMass; ball = addBall(Vector2(150, 150), 20, cCyan, startBalls); - ball->mass = 10; + ball->mass = startMass; } void creator::clean() {