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:
parent
b9fc172691
commit
b1e09b6dc4
|
@ -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
|
||||
|
|
25
Sources/armory/logicnode/SetFrictionNode.hx
Normal file
25
Sources/armory/logicnode/SetFrictionNode.hx
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue