Total members 11894 |It is currently Sun Nov 24, 2024 3:15 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





at the moment I'm working on writing a code for a interactive project. This project is made out of a 3dmodel, that I made in 3dsmax. I want to animate this model, and make it respond to an actual person by motion detectors and a camera that works together with a javascript code.

I'm trying to make this animated model walk to different coordinates. When doing so I have two different choices, either my object 'slides' to a location, or the object does a 'walkcycle' which remains in place. (So the background moves.) What I want, ideally, is a sliding walkcycle. This has to have a place where it has to stop, so it doesn't move out of the picture. (I hope this still makes some sense.)

I am now working in Unity3d. When the webcam receives a value above '200', the walking cycle begins. With the value is below 200 my object doesn't move.

My problem now is, that when the webcam gives these values above 200, the values don't go down anymore. My object gets stuck in it's animation and keeps repeating it.

My question is if maybe you can help me out with my code. This is the code:



Code:
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]); 
} 
 


Anyways, sorry for the long message and I really hope you can help me out. Thank you so much in advance for reading this!




Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Javascript code with Unity3D
 First Visit Pop Up Window javascript code     -  
 Preloading Images javascript code     -  
 Redirect to a New Page javascript code     -  
 Back to previous page javascript code     -  
 Status Bar Link Description javascript code     -  
 Reload a Window With a Button javascript code     -  
 Typing Status Bar Text javascript code     -  
 Javascript Code For Moving Images On Click Of A Button     -  
 Freeman chain code algorithm code     -  
 i want code for connecting mobile and pc can u send me code     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
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