WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-25-2011, 09:30 AM
kovitch kovitch is offline
Member
 
Join Date: Sep 2010
Posts: 30
Moving/grabbing 3D objects

Hi,

Is there any kind of example (something to start from) to move&grab objects from a place to another with the mouse, like in the following video:

http://www.youtube.com/watch?v=7qHPwqSsFZU

Best regards,

Alex.
Reply With Quote
  #2  
Old 12-01-2011, 02:00 PM
amith amith is offline
Member
 
Join Date: Dec 2011
Posts: 5
how to grab and move objects using mouse

Can anyone please help me on how i can grab and move objects in vizard 4 using mouse.

Waiting for a reply.Thanks a ton in advance.

Regards

Amith
Reply With Quote
  #3  
Old 12-01-2011, 04:48 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
You can use the viz.grab command to grab objects:
Code:
import viz
import vizact
import viztracker

viz.setMultiSample(4)
viz.fov(60)
viz.go()

viz.addChild('ground.osgb')
viz.clearcolor(viz.GRAY)

#Add the object that will do the grabbing
hand = viz.addChild('marker.wrl')

#link the hand to a 3D mousetracker
mouseTracker = viztracker.MouseTracker()
mouseTracker.scroll(-8)
viz.link(mouseTracker,hand)

#turn off mouse navigation and hide cursor
viz.mouse(viz.OFF)
viz.mouse.setVisible(viz.OFF)

#Add the object that the marker will grab
ball = viz.addChild( 'basketball.osgb',pos=[0.5,1.8,2.5],scale=[2,2,2])

link = None #The handle to the link object
def grabBall():
	global link
	link = viz.grab( hand, ball )
		
def releaseBall():
	global link
	link.remove()
	link = None
	
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,grabBall)
vizact.onmouseup(viz.MOUSEBUTTON_LEFT,releaseBall)
If you want a hand model that's animated when it grabs take a look at Grabbing with viztracker. That requires a configuration file that you create using the viztrackersetup utility. Make sure have Keybd w/ Mouse Hands set for tracker type, as shown in the image.
Reply With Quote
  #4  
Old 12-04-2011, 12:11 AM
amith amith is offline
Member
 
Join Date: Dec 2011
Posts: 5
Thank you so much for the reply.

Do you have any idea about how i can do the similar thing using a Wii.

Thanks a ton in advance.
Reply With Quote
  #5  
Old 12-05-2011, 07:37 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
There's documentation for the wiimote plug-in the Vizard Help. Also if you search for wiimote in these forums you'll find some example code. You can use vizact.onupdate or vizact.ontimer to register a callback function that gets called every frame. Within your function you can update the hand position based on wiimote data.
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
Trouble picking text3d objects Salvar Vizard 4 12-01-2010 03:07 PM
static or dynamic objects shahramy Vizard 2 11-10-2010 12:32 AM
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 03:09 AM
multiple objects durf Vizard 1 04-10-2009 01:42 PM
Could not find plugin to load objects... halley Vizard 1 05-30-2006 11:01 AM


All times are GMT -7. The time now is 02:45 PM.


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