Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
vor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
d73d432
)
proper moving-away detection in bounce()?
author
Joshua Grams
<josh@qualdan.com>
Sat, 25 Mar 2006 21:16:48 +0000
(21:16 +0000)
committer
Joshua Grams
<josh@qualdan.com>
Sat, 25 Mar 2006 21:16:48 +0000
(21:16 +0000)
sprite.c
patch
|
blob
|
history
diff --git
a/sprite.c
b/sprite.c
index
e63fd68
..
1a35a6a
100644
(file)
--- a/
sprite.c
+++ b/
sprite.c
@@
-349,8
+349,9
@@
bounce(Sprite *a, Sprite *b)
n = sqrt(x*x + y*y); x /= n; y /= n;
// velocities along (x, y), or 0 if already moving away.
- va = max(x*a->dx + y*a->dy, 0);
- vb = min(x*b->dx + y*b->dy, 0);
+ va = x*a->dx + y*a->dy;
+ vb = x*b->dx + y*b->dy;
+ if(vb-va > 0) return;
ma = sprite_mass(a); mb = sprite_mass(b);
vc = (va*ma + vb*mb) / (ma+mb);