Thread: Quick Question
View Single Post
  #2  
Old 04-23-2008, 05:23 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Are you trying to toggle between the orbit camera and normal view when joystick button 3 is pressed? If so, you will need to modify your code to look something like this:
Code:
import vizcam

cam = vizcam.PivotNavigate(distance=4)
cam.enabled = False

bodyLink = viz.link(body,view,dstFlag=viz.LINK_BODY)
bodyLink.preTrans([0,-0.29,0.2])

def joydown(e):
	if e.button == 3:
		cam.enabled = not cam.enabled
		if cam.enabled:
			bodyLink.disable()
			cam.centerNode(run)
		else:
			bodyLink.enable()

viz.callback(vizjoy.BUTTONDOWN_EVENT,joydown)
This code should properly toggle between the camera and body link. Let me know if anything is not clear.
Reply With Quote