WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-23-2008, 10:06 AM
rubberpimple rubberpimple is offline
Member
 
Join Date: Jan 2008
Location: Phoenix, Arizona
Posts: 16
Collision questions

Hi,
I'm currently using collision detection in my code, but I'd like to keep the intersecting object from passing though each other. I've read lots of posts but cannot get the right combination of physics, intersection and collision settings. Here's a sample of what I'm doing:
# Some Basics
viz.phys.enable()

viz.collision(1)

# Import a hand object
sensor = viz.add('MonkeyGlove.dls')

myHand = hand.add(sensor,hand.MONKEYGLOVE)
myHand.collidebox()
myHand.enable(viz.DYNAMICS)
myHand.disable(viz.INTERSECTION) myHand.enable(viz.COLLIDE_NOTIFY)

# Import a cylinder object
Cylinder = viz.add('cylinder2.wrl')
Cylinder.collidebox()
Cylinder.enable(viz.DYNAMICS)
Cylinder.disable(viz.INTERSECTION)
Cylinder.enable(viz.COLLIDE_NOTIFY)

I would like both objects to NOT be subject to gravitational forces, but would like for the hand to stop when it contacts the object, and for the object to stay in place as well.

Collisions are detected using the viz.phys.intersectNode(myHand) command

Any help is appreciated!
__________________
David
Reply With Quote
  #2  
Old 05-27-2008, 11:43 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
From what you described it seems like you just need to disable dynamics on both objects. This will remove the affect of gravity. If you are manually checking for collisions using the viz.phys.intersectNode command, then move the hand to its previous position when it intersects with the object. Let me know if I misunderstood your question.
Reply With Quote
  #3  
Old 05-28-2008, 12:46 PM
rubberpimple rubberpimple is offline
Member
 
Join Date: Jan 2008
Location: Phoenix, Arizona
Posts: 16
The gravity isn't the problem, just the collisions. I would like for the hand object to stop when it intersects the cylinder object, instead of passing into it.
__________________
David
Reply With Quote
  #4  
Old 05-28-2008, 12:54 PM
rubberpimple rubberpimple is offline
Member
 
Join Date: Jan 2008
Location: Phoenix, Arizona
Posts: 16
sorry, just a clarification...

I thought that the physics engine would have a method by which it would prevent two solid objects from occupying the same physical space, perhaps depending on some user-defined physical parameter such as density, hardness, etc....

From your reply I guess this isn't the case? Avoiding such overlaps must be done programatically?
__________________
David
Reply With Quote
  #5  
Old 05-29-2008, 09:46 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Ok, it sounds like you want to have a dynamic object whose position is controlled by a tracker? If so, then you will need to use a physics spring. You tell the spring the desired position/rotation of the object and the physics engine will apply the necessary forces to get the object to that position, but it will stop if it collides with other objects in the environment. Search the docs for addSpring, it is documented under the Forces section of the Physics engine reference.

We use this technique for scripts where a person uses their hand to interactive with a physics environment.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Collision detection with haptic pen mjabon Vizard 3 01-17-2008 06:35 PM
linked object collision pgagolf Vizard 1 04-19-2007 01:27 PM
Collision with avatars and scene not working JvdBosch Vizard 12 09-14-2006 06:01 PM
collision events trigger Eunice Vizard 1 01-03-2006 10:39 AM
Walking avatars --> collision detection? sjroorda Vizard 3 10-13-2005 04:47 AM


All times are GMT -7. The time now is 03:16 PM.


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