Get a UserTrigger in Javascript - Eg for SmoothMoves

How the heck do you get a UserTrigger in Javascript ?

Anyone know? Thanks!


For the record, here is the exact Javascript to do this in SmoothMoves.

Note it is very very important to remember to call newTest.Play(“one”) … do not accidentally call newTest.animation.Play(“one”) which is what you would be familiar with typing as a Unity developer. Of course, the latter will just call the “normal” animation of the object, and everything will go to hell, you very much want to call the actual SmoothMoves animation of the object!!

Here is the exact JS to register both SmoothMoves animations and SmoothMoves user-triggers. Thanks again Bérenger Mantoue !!!

#pragma strict

import SmoothMoves;

private var newTest:SmoothMoves.BoneAnimation;

public function testeCollider(uTE:SmoothMoves.ColliderTriggerEvent):void
	{ Debug.Log("the collider fired"); }

public function testeUserTrigger(uTE:SmoothMoves.UserTriggerEvent):void
	{ Debug.Log("the user-trigger fired"); }

function Start ()
	{
	newTest = GameObject.Find("newTest").GetComponent(SmoothMoves.BoneAnimation);
	
	newTest.RegisterColliderTriggerDelegate(this.testeCollider);
	newTest.RegisterUserTriggerDelegate(this.testeUserTrigger);
	
	Debug.Log("I did register everything.");
	}

function OnGUI()
	{
	if (GUI.Button (Rect (300,200,100,20), "play one"))
		newTest.Play("one");
	
	if (GUI.Button (Rect (420,200,100,20), "play two"))
		newTest.Play("two");
	}

Just to take it out of the unanswered :

The functions of registration are members of Smooth Moves’ class BoneAnimation, thus available in both javascript and C#.