WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 04-15-2005, 05:29 PM
vjosh vjosh is offline
Join Date: Sep 2004
Posts: 17
Collision Detection for Hierarchies of Objects


I'm having some trouble getting collision detection to work consistently with hierarchies of objects. I'll create a person and a ball with code like the following:
person = viz.add("male.cfg")
ball = person.add("ball.wrl")
After translating the ball to some location (using viz.ABSOLUTE_WORLD), I'll try to translate the person (also using viz.ABSOLUTE_WORLD), and the ball moves with the person as expected. But the problem is that the "collidingwith()" method thinks that the ball is still where I positioned it originally. As far as the collidingwith() method is concerned, the ball did not move with the person... Is there any way to fix this problem?

Reply With Quote
Old 04-15-2005, 05:46 PM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849

The collidingwith function does not take object hierarchies into account. You can use a temporary work around for this though. Add an empty object to the world. To check for collisions update the empty objects position with the balls position and then call collidingwith on the empty object. Here's some sample code to explain it better:
#Add a fake ball to the world (This will be an empty object)
fakeBall = viz.add(viz.GROUP)
#Enable collisions on the fake ball
fakeBall .collidesphere(0.25)

#Before you call collidingwith do the following
Reply With Quote

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 12:00 AM.

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