Fix crashes when object don't have rigid body

This commit is contained in:
knowledgenude 2020-09-05 12:27:29 -03:00 committed by GitHub
parent 042be35f06
commit b9fc172691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 0 deletions

View file

@ -21,6 +21,9 @@ class ApplyForceAtLocationNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
if (localLoc) {
location.applyQuat(object.transform.rot);
}

View file

@ -19,6 +19,9 @@ class ApplyForceNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
if (!local) {
rb.applyForce(force);
}

View file

@ -21,6 +21,9 @@ class ApplyImpulseAtLocationNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
if (localLoc) {
location.applyQuat(object.transform.rot);
}

View file

@ -19,6 +19,9 @@ class ApplyImpulseNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
if (!local) {
rb.applyImpulse(impulse);
}

View file

@ -18,6 +18,9 @@ class ApplyTorqueImpulseNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
rb.applyTorqueImpulse(torque);
#end

View file

@ -18,6 +18,9 @@ class ApplyTorqueNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
rb.applyTorque(torque);
#end

View file

@ -21,6 +21,9 @@ class SetVelocityNode extends LogicNode {
#if arm_physics
var rb: RigidBody = object.getTrait(RigidBody);
if (rb == null) return;
rb.activate();
rb.setLinearVelocity(linear.x, linear.y, linear.z);
rb.setLinearFactor(linearFactor.x, linearFactor.y, linearFactor.z);