WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-18-2015, 08:39 PM
SUJITH_KJ SUJITH_KJ is offline
Member
 
Join Date: Mar 2014
Posts: 7
getTransform() and getChild() doubts

Hello,

I have a 3D model which i opened in the inspector to get the names of the transforms. After that I used the getTransform() option and tried to perform collision detection, but the problem i faced was that there is no collideBox() attribute when i use the getTransform() option.. Alternately i tried using the getChild() option and i saw that it has the collideBox() attribute but somehow the collision detection is not working properly. Any reason or any mistake in my work???

Code:
dojo = viz.add('gear.OSGB')
fav = dojo.getChild('Q26-W840E011')
fav.collideBox()
fav.disable(viz.DYNAMICS)

vizact.onkeydown('f', fav.setPosition,[0,0,5],viz.REL_PARENT)

def new(g):
	if g.obj1 == rHandBox:
		print 'collided'	
	if g.obj2 == fav:
		l= viz.link(rHandBox,fav)
viz.callback(viz.COLLIDE_BEGIN_EVENT,new)
Reply With Quote
  #2  
Old 02-23-2015, 02:46 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,461
If you want to apply a collision shape to a sub-part of the model, try using the node parameter with the sub-part name:

Code:
#Create a collideBox surrounding a child node
table = viz.add( 'table.osgb' )
table.collideBox( node = 'Top')
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


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


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