mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
a minor optimization
This commit is contained in:
parent
bff1583902
commit
7d3f612ff9
@ -64,8 +64,6 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
||||
if (!bv->is_of_type(GeometricBoundingVolume::get_class_type())) {
|
||||
_local_bounds.push_back((GeometricBoundingVolume *)NULL);
|
||||
} else {
|
||||
LPoint3f pos_delta = def._node_path.get_pos_delta(root);
|
||||
|
||||
// We can use a plain pointer, rather than a PT() here, because we
|
||||
// know we are going to save the volume in the vector, below.
|
||||
GeometricBoundingVolume *gbv;
|
||||
@ -75,8 +73,9 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
||||
// world. The bounding volume should be extended by the object's
|
||||
// motion relative to each object it is considering a collision
|
||||
// with. That makes things complicated!
|
||||
if (bv->as_bounding_sphere() &&
|
||||
pos_delta != LVector3f::zero()) {
|
||||
if (bv->as_bounding_sphere()) {
|
||||
LPoint3f pos_delta = def._node_path.get_pos_delta(root);
|
||||
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
|
||||
// spheres, since (a) other kinds of volumes may not extend so
|
||||
@ -88,6 +87,7 @@ prepare_collider(const ColliderDef &def, const NodePath &root) {
|
||||
gbv_prev->xform(inv_trans);
|
||||
gbv->extend_by(gbv_prev);
|
||||
}
|
||||
}
|
||||
|
||||
CPT(TransformState) rel_transform = def._node_path.get_transform(root.get_parent());
|
||||
gbv->xform(rel_transform->get_mat());
|
||||
|
Loading…
x
Reference in New Issue
Block a user