WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-12-2012, 07:42 AM
pwsnow pwsnow is offline
Member
 
Join Date: Apr 2012
Posts: 23
Picking up Vizard Objects on mouse down with collisions

I'm trying to pick up vizard objects using a vizshape sphere as an end effector.

Because I have multiple objects I'm using onCollideBegin to grab the objects when the end effect collides with the object to be picked up. This work fine but the end effector doesn't let go of the object and it is automatic, however I want to be able to pick up objects when I touch them and hold them as long as the left mouse button is pressed. Releasing the object once the left mouse button is released. I have the below code in my updateview method:

Code:
def onCollideBegin(e):
		#while vizact.whilemousedown(viz.MOUSEBUTTON_LEFT):
			if e.obj1 == sphere:
				if e.obj2 == cube:
					link = viz.grab(sphere,cube)
					#viz.playSound( 'crashNew.wav' )
					
					libc.haDeviceSendString(dev, "set myDamper enable",response)
				if e.obj2 == cube2:
					link = viz.grab(sphere,cube2)
					libc.haDeviceSendString(dev, "set myDamper enable",response)
				if e.obj2 == ball:
					link = viz.grab(sphere,ball)
					libc.haDeviceSendString(dev, "set myDamper enable",response)			
	viz.callback(viz.COLLIDE_BEGIN_EVENT,onCollideBegin)
	
	#vizact.whilemousedown(viz.MOUSEBUTTON_LEFT,onCollideBegin)
	
	def onCollideEnd(e):
		if e.obj1 == sphere:
				if e.obj2 == cube:
					link = None
					libc.haDeviceSendString(dev, "set myDamper disable",response)
				if e.obj2 == cube2:
					link = None
					libc.haDeviceSendString(dev, "set myDamper disable",response)
				if e.obj2 == ball:
					link = None
					libc.haDeviceSendString(dev, "set myDamper disable",response)
	viz.callback(viz.COLLIDE_END_EVENT,onCollideEnd)
	
	
	

	vizact.onmousedown(viz.MOUSEBUTTON_LEFT,onCollideBegin)	
	#vizact.whilemousedown(viz.MOUSEBUTTON_LEFT,onCollideBegin)
	vizact.onmouseup(viz.MOUSEBUTTON_LEFT,onCollideEnd)
	#vizact.whilemouseup(viz.MOUSEBUTTON_LEFT,onCollideEnd)
Because def onCollideBegin/End is using an event how would I "wrap up" these two methods with the mouse down/up?

Many thanks.
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
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Trouble picking text3d objects Salvar Vizard 4 12-01-2010 03:07 PM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Pivot points for child objects in Vizard with 3ds Max Gladsomebeast Vizard 0 09-19-2006 11:21 AM


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


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