Set Friction Node and fix Ray Cast mask

Ray Cast node was not considering masks: https://github.com/armory3d/armory/issues/1780
This commit is contained in:
knowledgenude 2020-09-05 18:05:03 -03:00 committed by GitHub
parent b9fc172691
commit b1e09b6dc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -19,7 +19,7 @@ class CastPhysicsRayNode extends LogicNode {
#if arm_physics
var physics = armory.trait.physics.PhysicsWorld.active;
var hit = physics.rayCast(vfrom, vto, 1, mask);
var hit = physics.rayCast(vfrom, vto, mask);
var rb = (hit != null) ? hit.rb : null;
if (from == 0) { // Object

View file

@ -0,0 +1,25 @@
package armory.logicnode;
import iron.object.Object;
import armory.trait.physics.RigidBody;
class SetFrictionNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
var object: Object = inputs[1].get();
if (object == null) return;
var friction: Float = inputs[2].get();
#if arm_physics
var rigidBody = object.getTrait(RigidBody);
if (rigidBody != null) rigidBody.setFriction(friction);
#end
runOutput(0);
}
}