WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-28-2005, 08:50 AM
baf1 baf1 is offline
Member
 
Join Date: Mar 2005
Posts: 6
simple collision detection between 2 objects

hi, ive been searching a while through the help sectipn of vizard but have not yet been able to find a section about detecting whether or not 2 objects intersect, so i was wondering if vizard had this capability (after reading other people's posts it seemed like it did) and where i could find more information about it.
Reply With Quote
  #2  
Old 04-28-2005, 10:37 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Take a look at the following thread http://www.worldviz.com/forum/showth...3?threadid=283 .

A few posts down there is an explanation of all the collision functions. What you need to do is define the collision type of each object (i.e sphere, box, mesh). After that, to check if the objects are colliding you would do the following:
Code:
object1.collidesphere()
object2.collidemesh()
if object1.collidingwith(object2):
    print 'Objects are colliding'
Reply With Quote
  #3  
Old 04-29-2005, 08:21 AM
baf1 baf1 is offline
Member
 
Join Date: Mar 2005
Posts: 6
so i got the collision detection working with 2 simple objects but when i add a more complicated object:

c1 = viz.add('mvlpuma-waist.wrl')
c2 = c1.addchild('mvlpuma-shoulder.wrl')
c3 = c2.addchild('mvlpuma-upperarm.wrl')
c4 = c3.addchild('mvlpuma-forearm.wrl')
j1 = c4.addchild('mvlpuma-joint.wrl')
j2 = j1.addchild('mvlpuma-joint.wrl')
j3 = j2.addchild('mvlpuma-gripper.wrl')

tube = viz.add('object.wrl')

and want to detect a collision between the 'tube' and the last child on the parent ('mvlpuma-gripper.wrl'), it doesnt work. ive tried collidemesh and collide sphere, and it appears that no matter which one i choose (c1, c2...j3) vizard is always only detecting a collision between c1 and tube. how can i get vizard to detect the collision i want?
Reply With Quote
  #4  
Old 04-29-2005, 09:58 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The collision doesn't work with hierarchical objects. There was a similar question about this a week ago. Check out the following thread, it should provide the solution for you.

http://www.worldviz.com/forum/showth...=&threadid=325

Let me know if it doesn't help
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 07:11 PM.


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