WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   linking (https://forum.worldviz.com/showthread.php?t=2195)

yak 08-03-2009 12:30 PM

linking
 
Code:

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

Quote:

Originally Posted by farshizzo (Post 8464)
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)


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

Quote:

Originally Posted by farshizzo (Post 8501)
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.


All times are GMT -7. The time now is 02:30 AM.

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