X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=blobdiff_plain;f=src%2FEffects%2FGravity.cpp;h=5c654519f09e55138e02b7718b17cad47d080c04;hb=3d1f081343dc603a3292538eeb9bd794b255deb6;hp=d7852d38d623987063b877fe4076ffed3ee16dfd;hpb=ec70635e518dbd916303ec7d5ffa5e9b99bde565;p=physics.git diff --git a/src/Effects/Gravity.cpp b/src/Effects/Gravity.cpp index d7852d3..5c65451 100644 --- a/src/Effects/Gravity.cpp +++ b/src/Effects/Gravity.cpp @@ -1,5 +1,30 @@ +/* + * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "Gravity.h" +#include "Entities/PhysicsEntity.h" + +/// ***** Private Variables ***** + +float forceGravity = 0.001; + +/// ***** Constructors/Destructors ***** + Gravity::Gravity() { @@ -9,17 +34,9 @@ Gravity::~Gravity() } -Vector2 Gravity::positionDelta(const PhysicsEntity*, float) -{ - return Vector2(0, 0); -} - -Vector2 Gravity::velocityDelta(const PhysicsEntity*, float) -{ - return Vector2(0, 0); -} +/// ***** Public Class Methods ***** -Vector2 Gravity::forceDelta(const PhysicsEntity*, float) +Vector2 Gravity::forceDelta(const PhysicsEntity* e, float) const { - return Vector2(0, 0.000001); + return Vector2(0, e->mass * forceGravity); }