Thread: linking
View Single Post
  #4  
Old 08-10-2009, 03:01 PM
yak yak is offline
Member
 
Join Date: May 2009
Posts: 22
Quote:
Originally Posted by farshizzo View Post
You want the point to deform with the avatar mesh? If so, this is not currently possible. You can link the point to one of the avatars bones, but there is no way to get the associated bones from an intersection test.
how do u link it to the bone if point isnt an object. I know how to link object to object but not a point or command to object..

Code:
import viz
import viztask
viz.go()


bone =  viz.add('vcc_male.cfg', alpha= 0.8)
bones = bone.getbone('Bip01 L Thigh')
def DrawLineTask():
	
	while True:
		
		#Wait for left mouse butten to be pressed
		yield viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT)
		
		#Get mouse position
		pos = viz.mouse.getPosition()
		
		#Create line
		viz.startlayer(viz.POINTS)
		viz.vertexcolor(viz.RED)
		
		
	
		viz.vertex(pos[0],pos[1],0)
		viz.vertex(pos[0],pos[1],0)
		viz.ABS_PARENT
		point = viz.endlayer(parent=viz.SCREEN)
		
		#Create link between mouse position and vertex
		VertexLink = viz.link(viz.Mouse,point.Vertex(1))
		link = viz.link(point.Vertex(1),bones)
		link.preTrans( [0.03,-0.42,0.016] )
		link.preEuler( [-20,0,0] )
		#Wait for mouse button to be released
		yield viztask.waitMouseUp(viz.MOUSEBUTTON_LEFT)
		
		#Destroy link
		VertexLink.remove()
		
viztask.schedule( DrawLineTask() )

viz.mouse(viz.ON)

Last edited by yak; 08-10-2009 at 03:07 PM.
Reply With Quote