Imagine I put a cloth in the scene but I don’t want the cloth to get draped on stuff when the game begins. For instance, I might want to run the cloth physics simulation when my character passes a certain spot on the map. So how can I trigger the cloth simulation sometime during the game?
Does anyone know how to do this?
Thanks! Do you mean the physics simulations are like animations in Armory? Would it be possible for you to give a simple example on how I should use it in my Haxe script?
After it’s baked it might work.
Try the following:
package arm;
import iron.*;
class TimeAnimationStart extends iron.Trait {
public function new() {
super();
var object:iron.object.Object;
notifyOnInit(function() {
object=Scene.active.getChild("Cube");
object.animation.pause();
});
var first:Bool=true;
notifyOnUpdate(function() {
if (iron.system.Time.time()>5 && first) {
first=false;
object.animation.play("CubeAction", function(){}, 0.0, 1.0, true);
}
});
// notifyOnRemove(function() {
// });
}
}
If it gives a black screen on startup, it’s because the animation doesn’t exist, so you need to bake your physics to keyframes.