Logic Tweens: Scale, Location, Scale :)


Instruction and Armory project:

http://www.dzynek.pl/armory3d/9-free-tween-for-armory3d-move-scale-rotate

5 Likes

Hello,
I’m trying to use your library TweenToRotate, but I can’t get it work properly.
I want an object to get the transform of another object. It works for TweenToLocation with the node “Get Location” on the target object, but not with “Get Rotation” and TweenToRotate.
The results are strange. Does it works with Euler Angles, or other coordinate system ?
Do I need to respect some constraints ?
Thanks in advance for your help, this library could be really useful.
Mokauno.

I confirm the problem with TweenToRotate but I don’t know where the problem is.

I paste the code

package armory.logicnode;

import iron.Scene;
import iron.math.Vec4;
import iron.system.Tween;
import iron.object.Object;
import armory.trait.physics.RigidBody;

class TweenToRotateNode extends LogicNode {

	public var property0:String;	

	public function new(tree:LogicTree) {
	super(tree);
	}

	var o:Object;

	override function run(from:Int) {
		var t = inputs[1].get();
		o = inputs[2].get();
		var v1 = inputs[3].get();
		var e:Dynamic = Linear;
		
		if (o == null || v1 == null) return;

		switch (property0) {
		case "Linear":
			e = Linear;
		case "SineIn":
			e = SineIn;
		case "SineOut":
			e = SineOut;			
		case "SineInOut":
			e = SineInOut;
		case "QuadIn":
			e = QuadIn;
		case "QuadOut":
			e = QuadOut;
		case "QuadInOut":
			e = QuadInOut;
		case "CubicIn":
			e = CubicIn;
		case "CubicOut":
			e = CubicOut;
		case "CubicInOut":
			e = CubicInOut;
		case "QuartIn":
			e = QuartIn;
		case "QuartOut":
			e = QuartOut;
		case "QuartInOut":
			e = QuartInOut;
		case "QuintIn":
			e = QuintIn;
		case "QuintOut":
			e = QuintOut;
		case "QuintInOut":
			e = QuintInOut;
		case "ExpoIn":
			e = ExpoIn;
		case "ExpoOut":
			e = ExpoOut;
		case "ExpoInOut":
			e = ExpoInOut;
		case "CircIn":
			e = CircIn;
		case "CircOut":
			e = CircOut;
		case "CircInOut":
			e = CircInOut;
		case "BackIn":
			e = BackIn;
		case "BackOut":
			e = BackOut;
		case "BackInOut":
			e = BackInOut;

		}		

		iron.system.Tween.to({
				target: o.transform,
				props: { rot: v1 },
				duration: t,
				ease: e,
				tick: update,
				done: done
			});
	}

	function update() {
		#if arm_physics
			var rigidBody = o.getTrait(RigidBody);
			if (rigidBody != null) rigidBody.syncTransform();
		#end

		runOutput(0);	
	}

	function done() {
		runOutput(1);		
	}	
}

OK, I get something interesting.
I think it works, in logic nodes. It’s not exactly tweening, but it allow an object to target the rotation of another object, with a parametrable speed.