PDA

View Full Version : linking


yak
08-03-2009, 12:30 PM
import viz
import viztask
viz.go()




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.alpha(3)


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))

#Wait for mouse button to be released
yield viztask.waitMouseUp(viz.MOUSEBUTTON_LEFT)

#Destroy link
VertexLink.remove()

viztask.schedule( DrawLineTask() )


this code is for drawing points on a 3d model, mainly the male avatar. what I am stuck with is trying to link it to the male while he is animated so after i draw on him it is linked to him even after another action in demonstrated such as walking or picking something up.

farshizzo
08-04-2009, 03:53 PM
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.

yak
08-05-2009, 12:55 PM
I want the point to stick to the avatar so if hes walking the point is still on him.. i can only link objects i dont know how to link an object with a point....
thanks you for ur help

yak
08-10-2009, 03:01 PM
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..


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)

farshizzo
08-12-2009, 11:30 AM
Search the docs for "linkbones". There should be an example script that links a node to an avatar bone. However, as I already mentioned, there is currently no way to get a bone object from an intersection hit with an avatar.

yak
08-16-2009, 12:04 PM
Search the docs for "linkbones". There should be an example script that links a node to an avatar bone. However, as I already mentioned, there is currently no way to get a bone object from an intersection hit with an avatar.

I dont think a point can be linked......because it isnt really an object. is its for example a .wrl or .3ds or .cgf so i cant really figure out how to link them together.