; Physics types and triggers example (an ArcBasic extension) ; Ghosts (blue) fall through the shelf; solid balls land on it. ; The yellow zone counts what passes through it Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,5,-14 TurnEntity camera,10,0,0 light=CreateLight() RotateEntity light,50,30,0 Const TYPE_BALL=2, TYPE_GHOST=3, TYPE_SHELF=4 ground=CreatePlane() EntityColor ground,70,70,90 EntityPhysics ground,1 shelf=CreateCube() ScaleEntity shelf,6,.2,2 PositionEntity shelf,0,4,0 EntityPhysics shelf,1 EntityPhysicsType shelf,TYPE_SHELF ; ghosts pass through the shelf but still land on the ground PhysicsCollide TYPE_GHOST,TYPE_SHELF,False ; a trigger: an invisible box that notices bodies inside it zone=CreatePivot() PositionEntity zone,0,1.5,0 EntityPhysics zone,4 EntityShape zone,1,12,3,2 PhysicsDebug True While Not KeyHit(1) If Rand(0,15)=0 b=CreateSphere(8) ScaleEntity b,.3,.3,.3 PositionEntity b,Rnd(-5,5),9,0 EntityPhysics b,2 If Rand(0,1) EntityPhysicsType b,TYPE_GHOST EntityColor b,80,140,255 Else EntityPhysicsType b,TYPE_BALL EndIf EndIf UpdateWorld ghosts=0 For i=1 To TriggerCount(zone) If GetEntityPhysicsType(TriggerEntity(zone,i))=TYPE_GHOST Then ghosts=ghosts+1 Next RenderWorld Text 0,0,"Bodies in the zone: "+TriggerCount(zone)+" (ghosts: "+ghosts+")" Flip Wend End