WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   simple collision detection between 2 objects (https://forum.worldviz.com/showthread.php?t=334)

baf1 04-28-2005 08:50 AM

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.

farshizzo 04-28-2005 10:37 AM

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'


baf1 04-29-2005 08:21 AM

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?

farshizzo 04-29-2005 09:58 AM

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


All times are GMT -7. The time now is 01:21 AM.

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