projects
/
physics.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
30a93c3
)
fixed polygon penitration due to CoR
author
Patrik Gornicz
<Gornicz.P@gmail.com>
Wed, 21 Jan 2009 15:59:49 +0000
(10:59 -0500)
committer
Patrik Gornicz
<Gornicz.P@gmail.com>
Wed, 21 Jan 2009 15:59:49 +0000
(10:59 -0500)
Makefile
patch
|
blob
|
blame
|
history
src/Entities/PhysicsEntity.cpp
patch
|
blob
|
blame
|
history
src/Entities/PhysicsEntity.h
patch
|
blob
|
blame
|
history
src/collisionManager.cpp
patch
|
blob
|
blame
|
history
diff --git
a/Makefile
b/Makefile
index
f3e6ad8
..
77463d3
100644
(file)
--- a/
Makefile
+++ b/
Makefile
@@
-83,6
+83,8
@@
${BLDDIRS}:
${Q1}${PRNTFMT} "mkdir" "$@"
${Q2}mkdir -p $@
${Q1}${PRNTFMT} "mkdir" "$@"
${Q2}mkdir -p $@
+#${SRCSDIR}%.cpp: ${SRCSDIR}%.h
+
# cause the below directory rules to work out
.SECONDEXPANSION:
# cause the below directory rules to work out
.SECONDEXPANSION:
diff --git
a/src/Entities/PhysicsEntity.cpp
b/src/Entities/PhysicsEntity.cpp
index
9daff3a
..
d42d271
100644
(file)
--- a/
src/Entities/PhysicsEntity.cpp
+++ b/
src/Entities/PhysicsEntity.cpp
@@
-85,3
+85,8
@@
void PhysicsEntity::applyImpulse(const Vector2& impulse, const Vector2& at)
{
velocity += impulse;
}
{
velocity += impulse;
}
+
+void PhysicsEntity::applyNudge(const Vector2& vecPush)
+{
+ position += vecPush;
+}
diff --git
a/src/Entities/PhysicsEntity.h
b/src/Entities/PhysicsEntity.h
index
b4b5b9e
..
8e83266
100644
(file)
--- a/
src/Entities/PhysicsEntity.h
+++ b/
src/Entities/PhysicsEntity.h
@@
-43,6
+43,8
@@
class PhysicsEntity: public Entity
virtual void applyImpulse(const Vector2& impulse);
virtual void applyImpulse(const Vector2& impulse, const Vector2& at);
virtual void applyImpulse(const Vector2& impulse);
virtual void applyImpulse(const Vector2& impulse, const Vector2& at);
+ virtual void applyNudge(const Vector2& vecPush);
+
//protected:
Vector2 force;
//protected:
Vector2 force;
diff --git
a/src/collisionManager.cpp
b/src/collisionManager.cpp
index
8aa2dc7
..
95a2193
100644
(file)
--- a/
src/collisionManager.cpp
+++ b/
src/collisionManager.cpp
@@
-273,8
+273,8
@@
void applyCollision(Polygon* pPoly, Ball* pBall)
// CoR penetration fix, adds the jitters
// from center to point
// CoR penetration fix, adds the jitters
// from center to point
-
//Vector2 CollP = normal / normal.Length * Ball.R
adius;
-
//Ball.Position = Info.Point + CollP
;
+
Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->r
adius;
+
pBall->applyNudge(cInfo.point + vecCollP - pBall->positionRaw())
;
}
bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo)
}
bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo)