restored horizontal collision mode, still being used

This commit is contained in:
Darren Ranalli 2009-03-30 21:56:41 +00:00
parent d05d89a5e4
commit 509e414ef4
3 changed files with 29 additions and 1 deletions

View File

@ -13,3 +13,22 @@
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerPusher::set_horizontal
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void CollisionHandlerPusher::
set_horizontal(bool flag) {
_horizontal = flag;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionHandlerPusher::get_horizontal
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE bool CollisionHandlerPusher::
get_horizontal() const {
return _horizontal;
}

View File

@ -43,6 +43,7 @@ public:
////////////////////////////////////////////////////////////////////
CollisionHandlerPusher::
CollisionHandlerPusher() {
_horizontal = true;
}
////////////////////////////////////////////////////////////////////
@ -119,9 +120,12 @@ handle_entries() {
} else {
// Shove it just enough to clear the volume.
if (!surface_point.almost_equal(interior_point)) {
if (_horizontal) {
normal[2] = 0.0f;
}
// Just to be on the safe size, we normalize the normal
// vector, even though it really ought to be unit-length
// already.
// already (unless we just forced it horizontal, above).
normal.normalize();
ShoveData sd;

View File

@ -31,6 +31,9 @@ PUBLISHED:
CollisionHandlerPusher();
virtual ~CollisionHandlerPusher();
INLINE void set_horizontal(bool flag);
INLINE bool get_horizontal() const;
protected:
virtual bool handle_entries();
virtual void apply_net_shove(
@ -38,6 +41,8 @@ protected:
const LVector3f &force_normal);
virtual void apply_linear_force(ColliderDef &def, const LVector3f &force);
bool _horizontal;
public:
static TypeHandle get_class_type() {