mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add rigidbody:is_selectable, :set_selectable
This commit is contained in:
parent
04c367b476
commit
4b4026b028
6 changed files with 26 additions and 2 deletions
|
|
@ -175,9 +175,10 @@ std::optional<Entities::RaycastResult> Entities::rayCast(
|
|||
glm::ivec3 foundNormal;
|
||||
|
||||
for (auto [entity, eid, transform, body] : view.each()) {
|
||||
const auto& hitbox = body.hitbox;
|
||||
if (eid.uid == settings.ignoredUid || !body.enabled ||
|
||||
(settings.solidEntitiesOnly && !eid.def.solid) ||
|
||||
(!eid.def.selectable && !settings.includeNonSelectable)) {
|
||||
(!hitbox.selectable && !settings.includeNonSelectable)) {
|
||||
continue;
|
||||
}
|
||||
if (settings.entitiesFilter) {
|
||||
|
|
@ -187,7 +188,6 @@ std::optional<Entities::RaycastResult> Entities::rayCast(
|
|||
continue;
|
||||
}
|
||||
}
|
||||
const auto& hitbox = body.hitbox;
|
||||
glm::ivec3 normal;
|
||||
double distance;
|
||||
if (ray.intersectAABB(
|
||||
|
|
@ -330,6 +330,7 @@ void Entities::preparePhysics(float delta) {
|
|||
? rigidbody.mass
|
||||
: std::numeric_limits<float>::infinity();
|
||||
rigidbody.hitbox.elasticity = rigidbody.elasticity;
|
||||
rigidbody.hitbox.selectable = rigidbody.selectable;
|
||||
hitboxes.emplace_back(&rigidbody.hitbox);
|
||||
if (!eid.def.solid) {
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue