WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 12-23-2010, 07:38 PM
psykoko psykoko is offline
Member
 
Join Date: Dec 2010
Posts: 9
Hi. i did modify my code, but i don't work correctly.
please modify my code
Code:
import viz
import vizmat
import vizinfo
import socket
import struct
viz.go()

#Add an avatar to the scene
female = viz.add('vcc_female.cfg')
viz.clearcolor(0.5,0.5,1) 
female.setPosition([-0.08,0,0.8]) 
female.setEuler([0,0,0])
female.scale(1.4,1,1)



#Get a handle to the Arm bone
Forearm = female.getBone('Bip01 R Forearm')
Forearm.lock() 
Forearm.setEuler(0, -5, 0) 


UpperArm = female.getBone('Bip01 R UpperArm')
UpperArm.lock()
UpperArm.setEuler(0, -30, -80) 

Hand = female.getBone('Bip01 R Hand')
Hand.lock()

Head = female.getBone('Bip01 Head')
Head.lock()
Head.setPosition(-100,0,0)


Neck = female.getBone('Bip01 Neck')
Neck.lock()
Neck.setEuler(0,0,-15)




UDP_IP="localhost"
UDP_PORT=8000

sock = socket.socket( socket.AF_INET, # Internet
					socket.SOCK_DGRAM ) # UDP
sock.bind( (UDP_IP,UDP_PORT) )

udp = 0 
def example1():
	global udp 
	while True:
		data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
		udp = struct.unpack(">d", data)[0]
	True.close()
viz.director(example1)


def update():
	print udp 
	right = open('c:\\ownership\\test4.txt', 'a+')
	right.write(str(udp)+'\n') 
	
	if 0 < udp:
		a = Forearm.getEuler()
		A = a[2]
		n = max(A -0.5,-90)
		N = A + 90 
		Forearm.setEuler(0,0,n)	
		if n == -90:
			Forearm.setEuler([0,0,N])
					
	else :
		b = Forearm.getEuler()
		B = b[2]
		n2 = min(B +0.2,0)
		Forearm.setEuler(0,0,n2)
	
vizact.ontimer(0,update)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading OSG models and orientation Joran Vizard 4 06-18-2009 05:43 AM
intersense with 5DT glove sjp Vizard 2 04-06-2009 07:22 AM
Problems loading WRL file DrunkenBrit Vizard 2 01-29-2009 12:58 AM
Loading .3ds-Files without interrupting Program flow Stefan Vizard 10 06-08-2005 04:44 PM
Script loading problem JRichizzle Vizard 1 03-12-2004 10:03 AM


All times are GMT -7. The time now is 07:19 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC