WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Main view collision problem (https://forum.worldviz.com/showthread.php?t=3938)

AtomicRaiden 10-04-2011 11:54 AM

Main view collision problem
 
Hey guys,

I am working on a school project and I am trying to create door animations. I put a cube around a door for collision purposes for a simple collision detection. I have the cube set with .enable( viz.COLLIDE_NOTIFY ) and a callback for collisions event. The problem I am having is that the walls are also throwing a collide event even though I only have the door collision cube with the collide event. I was wondering is there was work around to only have the door collision throw the event and nothing else?

Jeff 10-04-2011 02:50 PM

It sounds like you also have collision shapes applied to the walls. In that case you can check to see which objects are involved in the collision. These are passed with the event object to the callback function as the attributes obj1 (node that generated the event) and obj2 (node it collided with). If obj2 is the door then you can animate it opening, otherwise you can ignore the collision.

AtomicRaiden 10-05-2011 06:30 PM

I did not apply any collision shapes to any .IVE I imported. I am currently only using the geometry of the wall itself as collision. I simply imported the .IVE's and placed them in the world with no additional functions added to the objects. The only object I modified was the door collision box. I tried to print out object1 and object2 but only object1 is being collided with during the collisions. When I try to print out object2 an error is thrown. I appreciate your info provided but is there something else I am missing?

AtomicRaiden 10-06-2011 09:56 AM

When I import my .IVE's I am not applying any collision shapes. I am simply using the geometry of the walls and other objects as the collision. I didn't add any modifiers to the objects I imported expect for the door collision box. Additionally in Vizard 4.0 I noticed that the collision callback event does not have obj1 or obj2 anymore and only has "object". Is there another way to determine whether the door collision is being collided when the collision event gets called? Thanks for given info and anymore provided in the future.

Jeff 10-06-2011 11:48 AM

Sorry, I didn't pay attention to the subject here. In my last post I was referring to collisions regarding the physics engine. When handling viewpoint collision, the event object passed to the callback function has information about the node collided with, the point of contact and the name of the subnode:

http://docs.worldviz.com/vizard/Even...OLLISION_EVENT

The viz.COLLIDE_NOTIFY flag you mentioned is related to collision events with the physics engine, not viewpoint collision. When you enable viewpoint collision all objects will automatically be included. You can disable viewpoint collision for a specific object:
Code:

object.disable(viz.INTERSECTION)
If you have added two different objects, a room and a cube for the door you can check to see if the object is the cube:
Code:

def onCollision(info):
        if info.object == cube:
                #open door
       
viz.callback(viz.COLLISION_EVENT, onCollision)



All times are GMT -7. The time now is 11:42 PM.

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