WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-11-2009, 12:27 PM
yak yak is offline
Member
 
Join Date: May 2009
Posts: 22
meaning of code

Hi i was wondering what this code means

import viz

viz.go()

wheelbarrow = viz.add('vcc_male.cfg')
wheelbarrow.translate(0,1,3)

wheelbarrow.state(2)
wheelbarrow.rotate(0,3,0, -90)
viz.clearcolor(0.5,0.5,1)



def myslider(obj, pos):
wheelbarrow.runAction( vizact.spin(0,-1,0,500*pos) )


viz.callback(viz.SLIDER_EVENT,myslider)


I keep getting my male model to spin while walking. What I am trying to accomplish is that the slider controls my models walk. so if i slide my slider to teh end, my male model has completed one cycle of walking...If i slide it back he is being reversed(kind of like a fastforward and rewind )....I dont know if that made any sense.
Reply With Quote
  #2  
Old 07-13-2009, 09:59 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
That code is adding a spin action to the object when the slider is moved. If you want to move through an avatar animation using the slider, the following code should help:
Code:
import viz
viz.go()

#Initialize avatar
male = viz.add('vcc_male.cfg')
male.setPosition(0,0,5)
male.setEuler(180,0,0)

ANIM = 6
DUR = male.getDuration(ANIM)

#Start animation
male.execute(ANIM)
male.setAnimationSpeed(ANIM,0) #Speed must be set after animation is executed

#Use slider to modify animation time
slider = viz.addSlider(pos=(0.5,0.1,0))
def myslider(pos):
	male.setAnimationTime(ANIM,pos*DUR-0.01)
vizact.onslider(slider,myslider)
Reply With Quote
  #3  
Old 07-13-2009, 01:59 PM
yak yak is offline
Member
 
Join Date: May 2009
Posts: 22
Quote:
Originally Posted by farshizzo View Post
That code is adding a spin action to the object when the slider is moved. If you want to move through an avatar animation using the slider, the following code should help:
Code:
import viz
viz.go()

#Initialize avatar
male = viz.add('vcc_male.cfg')
male.setPosition(0,0,5)
male.setEuler(180,0,0)

ANIM = 6
DUR = male.getDuration(ANIM)

#Start animation
male.execute(ANIM)
male.setAnimationSpeed(ANIM,0) #Speed must be set after animation is executed

#Use slider to modify animation time
slider = viz.addSlider(pos=(0.5,0.1,0))
def myslider(pos):
	male.setAnimationTime(ANIM,pos*DUR-0.01)
vizact.onslider(slider,myslider)
thanks you your teh man!
Reply With Quote
  #4  
Old 07-15-2009, 01:18 PM
yak yak is offline
Member
 
Join Date: May 2009
Posts: 22
Quote:
Originally Posted by farshizzo View Post
That code is adding a spin action to the object when the slider is moved. If you want to move through an avatar animation using the slider, the following code should help:
Code:
import viz
viz.go()

#Initialize avatar
male = viz.add('vcc_male.cfg')
male.setPosition(0,0,5)
male.setEuler(180,0,0)

ANIM = 6
DUR = male.getDuration(ANIM)

#Start animation
male.execute(ANIM)
male.setAnimationSpeed(ANIM,0) #Speed must be set after animation is executed

#Use slider to modify animation time
slider = viz.addSlider(pos=(0.5,0.1,0))
def myslider(pos):
	male.setAnimationTime(ANIM,pos*DUR-0.01)
vizact.onslider(slider,myslider)
What if I want to make multiple sliders that control different actions such as walking or jumpin, what should I add in the code?
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Example code for VizCave stefs Vizard 6 01-08-2013 11:43 AM
Any ideas on linking chess 3ds file with source code? djones1010 Vizard 1 04-24-2009 09:56 PM
Trying to integrate Source Code with Vizard djones1010 Vizard 1 03-10-2009 02:58 PM
Vizard Tip of the Month: Use Tasks to Simplify your Code Gladsomebeast Vizard 5 05-02-2008 04:30 PM
Vizard Crashes: causes are hard to determine, possible problem with the viz code vr_boyko Vizard 1 01-07-2005 10:52 AM


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


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