CollisionEntrySorter: Check if entry has surface point

Fixes #435
This commit is contained in:
loblao 2018-10-30 12:13:58 -03:00 committed by rdb
parent 14411f592e
commit 604366aaa7

View File

@ -22,11 +22,16 @@ class CollisionEntrySorter {
public:
CollisionEntrySorter(CollisionEntry *entry) {
_entry = entry;
if (entry->has_surface_point()) {
LVector3 vec =
entry->get_surface_point(entry->get_from_node_path()) -
entry->get_from()->get_collision_origin();
_dist2 = vec.length_squared();
}
else {
_dist2 = make_inf((PN_stdfloat)0);
}
}
bool operator < (const CollisionEntrySorter &other) const {
return _dist2 < other._dist2;
}