+3 physics nodes
This commit is contained in:
parent
5c1b55d221
commit
dc1ae7aece
23
Sources/armory/logicnode/RemoveFromWorldNode.hx
Normal file
23
Sources/armory/logicnode/RemoveFromWorldNode.hx
Normal file
|
@ -0,0 +1,23 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.object.Object;
|
||||
import armory.trait.physics.RigidBody;
|
||||
|
||||
class RemoveFromWorldNode extends LogicNode {
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
override function run(from: Int) {
|
||||
var object: Object = inputs[1].get();
|
||||
if (object == null) return;
|
||||
|
||||
#if arm_physics
|
||||
var rigidBody = object.getTrait(RigidBody);
|
||||
if (rigidBody != null) rigidBody.removeFromWorld();
|
||||
#end
|
||||
|
||||
runOutput(0);
|
||||
}
|
||||
}
|
35
Sources/armory/logicnode/SetActivationStateNode.hx
Normal file
35
Sources/armory/logicnode/SetActivationStateNode.hx
Normal file
|
@ -0,0 +1,35 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.object.Object;
|
||||
import armory.trait.physics.RigidBody;
|
||||
|
||||
/**
|
||||
define ACTIVE_TAG 1
|
||||
define ISLAND_SLEEPING 2
|
||||
define WANTS_DEACTIVATION 3
|
||||
define DISABLE_DEACTIVATION 4
|
||||
define DISABLE_SIMULATION 5
|
||||
**/
|
||||
|
||||
class SetActivationStateNode 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 state: Int = inputs[2].get();
|
||||
if (state < 0) return;
|
||||
if (state > 5) return;
|
||||
|
||||
#if arm_physics
|
||||
var rigidBody = object.getTrait(RigidBody);
|
||||
if (rigidBody != null) rigidBody.setActivationState(state);
|
||||
#end
|
||||
|
||||
runOutput(0);
|
||||
}
|
||||
}
|
23
Sources/armory/logicnode/SyncTransformNode.hx
Normal file
23
Sources/armory/logicnode/SyncTransformNode.hx
Normal file
|
@ -0,0 +1,23 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.object.Object;
|
||||
import armory.trait.physics.RigidBody;
|
||||
|
||||
class SyncTransformNode extends LogicNode {
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
override function run(from: Int) {
|
||||
var object: Object = inputs[1].get();
|
||||
if (object == null) return;
|
||||
|
||||
#if arm_physics
|
||||
var rigidBody = object.getTrait(RigidBody);
|
||||
if (rigidBody != null) rigidBody.syncTransform();
|
||||
#end
|
||||
|
||||
runOutput(0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue