WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 11-03-2012, 11:43 AM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
Jeff, thanks for the reply. I've created a simple example below for your review. I've assigned three different centers to rotate about in my Kinematic function.

Code:
import viztask
import viz
import vizshape
import vizcam
import vizact
viz.go()

viz.clearcolor(0.5,0.7,1)

#Change navigation style to pivot
cam = vizcam.PivotNavigate(center=[0,0,0], distance = 25) 
cam.rotateUp(45)
cam.rotateRight(0)

#Add grid
grid = vizshape.addGrid()
grid.color(viz.GRAY)
grid.collidePlane()   # Make collideable plane

#Add an object.
shaft = vizshape.addCylinder(height = 5, radius = .25, slices = 15)

r = 5
def Kinematics_1(rotation1):	
	shaft.center =(1,1,1)
	vizact.whilekeydown('a',shaft.setEuler,[0,vizact.elapsed(r),0],viz.REL_LOCAL)
		
	shaft.center = (2,2,2)
	vizact.whilekeydown('s',shaft.setEuler,[0,vizact.elapsed(-r),0],viz.REL_LOCAL)
	
	shaft.center = (3,3,3)
	vizact.whilekeydown('d',shaft.setEuler,[vizact.elapsed(-r),0,0],viz.REL_LOCAL)
	vizact.whilekeydown('f',shaft.setEuler,[vizact.elapsed(r),0,0],viz.REL_PARENT)

def Main_Loop(rot):
	while True:
		print 'shaft center = ', shaft.getCenter()
		yield Kinematics_1(r)
		print ''
viztask.schedule(Main_Loop(r))
The center, in this example, actually remains at (0,0,0) and does not get assigned to (1,1,1), (2,2,2), or (3,3,3). However, the keyboard rotations all work correctly. Does this make sense?

Furthermore, the 'f' key would not rotate with viz.REL_LOCAL for some reason, but does for viz.REL_PARENT (even though there is no parent present).

Thanks for your help. Hopefully I'm missing something silly.
Reply With Quote
 


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
joystick position nmohandes Vizard 2 01-16-2012 10:03 AM
writing joystick position to a data file Saz Vizard 3 12-17-2008 05:18 AM
Joystick Navigation Vinicius Lima Vizard 7 10-23-2007 10:42 AM
Facetracking and Immersion Joystick Vygreif Vizard 1 01-25-2006 10:56 AM
animating custom faces: in search of "open_mouth" morphs vr_boyko Vizard 1 09-16-2004 10:30 AM


All times are GMT -7. The time now is 08:03 PM.


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