ArcBasicDocs
3DPhysicsArcBasic extension

EntityPhysicsType

Puts a physics body in a type (1 to 32) for PhysicsCollide and triggers.

EntityPhysicsType entity,type

Parameters

entity
entity handle
type
1 to 32. Bodies start as type 1.

Description

Puts a physics body (or trigger) in a type, so that PhysicsCollide can choose which types collide - for ghosts that pass through walls, bullets that ignore the player who fired them, or debris that doesn't get in the way.

A trigger notices only the types that collide with its own. Physics types are separate from the classic collision types of EntityType.

Example

EntityPhysicsType.absOpen in editor
; 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 itGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,5,-14TurnEntity camera,10,0,0light=CreateLight()RotateEntity light,50,30,0Const TYPE_BALL=2, TYPE_GHOST=3, TYPE_SHELF=4ground=CreatePlane()EntityColor ground,70,70,90EntityPhysics ground,1shelf=CreateCube()ScaleEntity shelf,6,.2,2PositionEntity shelf,0,4,0EntityPhysics shelf,1EntityPhysicsType shelf,TYPE_SHELF; ghosts pass through the shelf but still land on the groundPhysicsCollide TYPE_GHOST,TYPE_SHELF,False; a trigger: an invisible box that notices bodies inside itzone=CreatePivot()PositionEntity zone,0,1.5,0EntityPhysics zone,4EntityShape zone,1,12,3,2PhysicsDebug TrueWhile 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+")"	FlipWendEnd

See also