mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
fluid capping options
This commit is contained in:
parent
31fb723776
commit
6a0d9b0a3b
@ -19,6 +19,7 @@
|
||||
#include "collisionLevelStateBase.h"
|
||||
#include "collisionSolid.h"
|
||||
#include "collisionNode.h"
|
||||
#include "config_collide.h"
|
||||
#include "dcast.h"
|
||||
|
||||
PStatCollector CollisionLevelStateBase::_node_volume_pcollector("Collision Volumes:PandaNode");
|
||||
@ -75,6 +76,11 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
||||
// with. That makes things complicated!
|
||||
if (bv->as_bounding_sphere()) {
|
||||
LPoint3f pos_delta = def._node_path.get_pos_delta(root);
|
||||
|
||||
LVector3f cap(pos_delta);
|
||||
if(cap.length()>fluid_cap_amount) {
|
||||
pos_delta=LPoint3f(cap/cap.length())*fluid_cap_amount;
|
||||
}
|
||||
if (pos_delta != LVector3f::zero()) {
|
||||
// If the node has a delta, we have to include the starting
|
||||
// position in the volume as well. We only do this for bounding
|
||||
@ -84,6 +90,7 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
||||
LMatrix4f inv_trans = LMatrix4f::translate_mat(-pos_delta);
|
||||
PT(GeometricBoundingVolume) gbv_prev;
|
||||
gbv_prev = DCAST(GeometricBoundingVolume, bv->make_copy());
|
||||
|
||||
gbv_prev->xform(inv_trans);
|
||||
gbv->extend_by(gbv_prev);
|
||||
}
|
||||
|
@ -30,9 +30,11 @@
|
||||
#include "plist.h"
|
||||
#include "pStatCollector.h"
|
||||
#include "bitMask.h"
|
||||
#include "lvector3.h"
|
||||
#include "register_type.h"
|
||||
#include "collisionSolid.h"
|
||||
|
||||
|
||||
class CollisionSolid;
|
||||
class CollisionNode;
|
||||
|
||||
|
@ -86,6 +86,9 @@ ConfigVariableBool flatten_collision_nodes
|
||||
"to be efficient, and combining CollisionNodes is likely "
|
||||
"to merge bounding volumes inappropriately."));
|
||||
|
||||
ConfigVariableInt fluid_cap_amount
|
||||
("fluid-cap-amount", 100,
|
||||
PRC_DESC("ensures that fluid pos doesn't check beyond X feet"));
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: init_libcollide
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "pandabase.h"
|
||||
#include "notifyCategoryProxy.h"
|
||||
#include "configVariableBool.h"
|
||||
#include "configVariableInt.h"
|
||||
|
||||
NotifyCategoryDecl(collide, EXPCL_PANDA_COLLIDE, EXPTP_PANDA_COLLIDE);
|
||||
|
||||
@ -29,6 +30,7 @@ extern EXPCL_PANDA_COLLIDE ConfigVariableBool respect_prev_transform;
|
||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool respect_effective_normal;
|
||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool allow_collider_multiple;
|
||||
extern EXPCL_PANDA_COLLIDE ConfigVariableBool flatten_collision_nodes;
|
||||
extern EXPCL_PANDA_COLLIDE ConfigVariableInt fluid_cap_amount;
|
||||
|
||||
extern EXPCL_PANDA_COLLIDE void init_libcollide();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user