export CVSROOT=//smbhelp/vr-dive/cvsroot cvs checkout collisionIf you aren't able to see the repository then you download a zipped version here: collision-demo.tgz.
This demo works with all recent versions of DIVE.
The demo is a version of 127, with collision detection, collision prevention, with invisible and visible objects and with gravity and surface following on.
Collision detection depends critically on the avatar. Your avatar needs to have an AURA to cause collision events, and it needs to have a FOOT to enable collision prevention.
Collision events are caused by collision of the aura with objects in the scene. Thus when using the demo, you will notice when you get near an object. You can change this behaviour by changing the aura shape. If an avatar doesn't have an aura, then DIVE adds one automatically. See marking your avatar inside vishnu and then looking at the tree.
Collision penetration prevention, is configured using distance from the "bottom" or "right_foot" object. If neither exist "right_foot" will be added automatically. (You might also find "bottom" as an associated object name for "right_foot" - see the meny Self/Associated Objects). You can configure the distance for collision prevention (AJS TO CHECK HOW - something to do with "center" object - let me know if this is important).
For surface following, it is the "right_foot" or "bottom" object that follows the ground. You can "step up" a certain distance over obstacles. You will fall under gravity to the next lowest surface under you. (AJS TO CHECK CONFIGURATION OF THIS).
person_collision_solid 1 person_collision 0 # Set if you want auto collision detection person_gravity 0 # Set if you want auto gravity (works only # with person_collision)person_collision_solid means that the avatar can only collide with solid objects.
object { solid off collision on visibility off inline "box1.vr" begin.tcl proc oncollision {event id1 id2 type} { puts "Mel's old office" } dive_register COLLISION_SIGNAL DIVE_COLLISION [dive_self] "" oncollision end.tcl }Objects can be collidable "collision on" regardless of whether they are visible or solid. "solid on" objects are solid(!). Note that the person_collision_solidn configure variable means that the avatar can only collide with solid objects.
In that code you can also see the syntax for registering interest in collisions. See the demo for more variations.
Anthony Steed, A.Steed@cs.ucl.ac.uk