PDA

View Full Version : Left Hand


rubberpimple
02-01-2008, 09:32 AM
I need to animate a LEFT hand in Vizard...is there some easy way to mirror the stock hand.cfg??

farshizzo
02-01-2008, 10:05 AM
If you are using the hand module, then you can use the following code:import hand
h = hand.add(sensor)

#Display as left hand
h.leftHand()If you are manually loading the hand.cfg file, then you can us the following code:hand = viz.add('hand.cfg')
hand.scale(-1,1,1)
hand.enable(viz.FLIP_POLYGON_ORDER)

rubberpimple
02-05-2008, 02:00 PM
Using the second option gives me a darkly-shaded, flipped-over (palm facing up) hand. Is there a better way?

farshizzo
02-05-2008, 02:07 PM
If you run the following script does the shading on the left hand look darker than the right hand?import viz
viz.go()

rhand = viz.add('hand.cfg',pos=(0.1,1.8,0.5),euler=(0,-90,0))

lhand = viz.add('hand.cfg',pos=(-0.1,1.8,0.5),euler=(0,-90,0))
lhand.scale(-1,1,1)
lhand.enable(viz.FLIP_POLYGON_ORDER)

rhand.add(vizact.spin(0,0,1,45))
lhand.add(vizact.spin(0,0,-1,45))

rubberpimple
02-05-2008, 03:03 PM
Wow...those look perfect. I think there is something else in my code that is mucking things up. I'll investigate...

rubberpimple
02-05-2008, 03:05 PM
Does messing with window POV commands have this effect?

farshizzo
02-05-2008, 03:07 PM
Can you just post a sample script of yours that makes the left hand darker?

rubberpimple
02-05-2008, 03:16 PM
Here it is:

myHand = viz.add('hand.cfg',pos=(0.1,1.8,0.5),euler=(0,-90,0))
myHand.scale(-1,1,1)
myHand.enable(viz.FLIP_POLYGON_ORDER)
myHand.setScale(20,20,20)

It's the setScale command. Not sure why, but the hand becomes right handed and appears darker.

farshizzo
02-05-2008, 03:17 PM
Your sample code is undoing the negative x scale, which is required for inverting the hand and making it look left handed. Use the following code instead:myHand = viz.add('hand.cfg',pos=(0.1,1.8,0.5),euler=(0,-90,0))
myHand.enable(viz.FLIP_POLYGON_ORDER)
myHand.setScale(-20,20,20)

rubberpimple
02-05-2008, 03:20 PM
Nice! Many thanks...