![]() |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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)
|
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |