physent-volume resize with collision detection for better crouching

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2838 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-10-05 12:50:44 +00:00
parent 7e5728a5ab
commit 1a8ad9e4d1
11 changed files with 78 additions and 63 deletions
+2 -2
View File
@@ -169,7 +169,7 @@ static inline bool intersect(const vec &o, const vec &rad, const vec &from, cons
bool intersect(dynent *d, const vec &from, const vec &to, vec *end)
{
const float eyeheight = d->dyneyeheight();
const float eyeheight = d->eyeheight;
vec o(d->o);
o.z += (d->aboveeye - eyeheight)/2;
return intersect(o, vec(d->radius, d->radius, (d->aboveeye + eyeheight)/2), from, to, end);
@@ -259,7 +259,7 @@ void hitpush(int damage, playerent *d, playerent *at, vec &from, vec &to, int gu
float expdist(playerent *o, vec &dir, const vec &v)
{
vec middle = o->o;
middle.z += (o->aboveeye-o->dyneyeheight())/2;
middle.z += (o->aboveeye-o->eyeheight)/2;
float dist = middle.dist(v, dir);
dir.div(dist);
if(dist<0) dist = 0;