Mon Mar 22, 2010 9:55 pm
public var RemoteIP : String = "127.0.0.1";
public var SendToPort : int = 9000;
public var ListenerPort : int = 8000;
public var Controller: Transform;
private var handler : Osc;
private var sigX : int = 160;
private var sigY : int = 120;
public function Start ()
{
var udp : UDPPacketIO = GetComponent("UDPPacketIO");
udp.init(RemoteIP, SendToPort, ListenerPort);
handler = GetComponent("Osc");
handler.init(udp);
handler.SetAddressHandler("/X-as",X);
handler.SetAddressHandler("/Y-as",Y);
}
Debug.Log("Start");
function Update ()
{
var go = GameObject.Find("model");
go.animation.wrapMode = WrapMode.Once;
go.animation["idle"].wrapMode = WrapMode.Loop;
go.animation.Play("idle");
if(sigX > 200) {
go.animation.Play("walk");
}
}
public function X (oscMessage : OscMessage) : void
{
Debug.Log(Osc.OscMessageToString(oscMessage));
sigX = (oscMessage.Values[0]);
}
public function Y (oscMessage : OscMessage) : void
{
Debug.Log(Osc.OscMessageToString(oscMessage));
sigY = (oscMessage.Values[0]);
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.