for fix_illegal_wall_intersection() try using the distance we moved to move out from the wall. Just in case it's a sane value, i.e. > 0 and <= obj->size/2
This commit is contained in:
parent
9b17431c45
commit
270a86da56
|
@ -4,6 +4,7 @@ D2X-Rebirth Changelog
|
||||||
--------
|
--------
|
||||||
main/fvi.c, main/fvi.h, main/physics.c: Improvement for fix_illegal_wall_interesection(): Move away from wall in right angle - not towards center. This improves the bumping in many situations and prevents ship getting stuck in small segments. Simplified and optimized code as well and removed check for degenerated Segments as not needed with this approach; Fixed some compiler warnings regarding set but unused variables
|
main/fvi.c, main/fvi.h, main/physics.c: Improvement for fix_illegal_wall_interesection(): Move away from wall in right angle - not towards center. This improves the bumping in many situations and prevents ship getting stuck in small segments. Simplified and optimized code as well and removed check for degenerated Segments as not needed with this approach; Fixed some compiler warnings regarding set but unused variables
|
||||||
main/multi.c: Reset new_Bounty_target after using it and let host add a number on how often Bounty is reassigned. Both additions should help keeping target correct no matter how if multiple packets of the same type are disordered, delayed or both
|
main/multi.c: Reset new_Bounty_target after using it and let host add a number on how often Bounty is reassigned. Both additions should help keeping target correct no matter how if multiple packets of the same type are disordered, delayed or both
|
||||||
|
main/physics.c: for fix_illegal_wall_intersection() try using the distance we moved to move out from the wall. Just in case it's a sane value, i.e. > 0 and <= obj->size/2
|
||||||
|
|
||||||
20110516
|
20110516
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -298,16 +298,21 @@ void do_physics_sim_rot(object *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// On joining edges fvi tends to get inaccurate as hell. Approach is to check if the object interects with the wall and if so, move away from it.
|
// On joining edges fvi tends to get inaccurate as hell. Approach is to check if the object interects with the wall and if so, move away from it.
|
||||||
void fix_illegal_wall_intersection(object *obj)
|
void fix_illegal_wall_intersection(object *obj, vms_vector *origin)
|
||||||
{
|
{
|
||||||
int hseg = -1, hside = -1, hface = -1;
|
int hseg = -1, hside = -1, hface = -1;
|
||||||
|
fix dist;
|
||||||
|
|
||||||
if (!(obj->type == OBJ_PLAYER || obj->type == OBJ_ROBOT))
|
if (!(obj->type == OBJ_PLAYER || obj->type == OBJ_ROBOT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dist = vm_vec_dist(&obj->pos, origin);
|
||||||
|
if (dist <= 0 || dist > obj->size/2)
|
||||||
|
dist = FrameTime*10;
|
||||||
|
|
||||||
if ( object_intersects_wall_d(obj,&hseg,&hside,&hface) )
|
if ( object_intersects_wall_d(obj,&hseg,&hside,&hface) )
|
||||||
{
|
{
|
||||||
vm_vec_scale_add2(&obj->pos,&Segments[hseg].sides[hside].normals[0],FrameTime*10);
|
vm_vec_scale_add2(&obj->pos,&Segments[hseg].sides[hside].normals[0],dist);
|
||||||
update_object_seg(obj);
|
update_object_seg(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,7 +763,7 @@ void do_physics_sim(object *obj)
|
||||||
vm_vec_copy_scale(&obj->mtype.phys_info.velocity,&moved_vec,fixdiv(f1_0,FrameTime));
|
vm_vec_copy_scale(&obj->mtype.phys_info.velocity,&moved_vec,fixdiv(f1_0,FrameTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
fix_illegal_wall_intersection(obj);
|
fix_illegal_wall_intersection(obj, &start_pos);
|
||||||
|
|
||||||
//Assert(check_point_in_seg(&obj->pos,obj->segnum,0).centermask==0);
|
//Assert(check_point_in_seg(&obj->pos,obj->segnum,0).centermask==0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue