ArcBasicDocs
3DShadowsArcBasic extension

EntityShadows

Sets whether an entity casts and receives shadows.

EntityShadows entity,cast[,receive]

Parameters

entity
entity handle
cast
True if the entity casts shadows, False if it does not
receive (optional)
True if shadows fall on the entity, False if they do not. Defaults to True.

Description

Sets whether an entity casts shadows and whether shadows fall on it, for lights that have shadows switched on with LightShadows.

Until EntityShadows is used on an entity, it casts shadows if it is solid lit geometry: meshes, terrains and loaded models cast shadows, while sprites, full-bright entities (EntityFX 1) and entities drawn behind everything else with a positive EntityOrder (such as sky boxes) do not. Every entity receives shadows unless it is full-bright.

Use EntityShadows entity,False to stop things like particle effects, glass or fake blob shadows from casting a shadow, and EntityShadows entity,True to make a sprite cast one.

Copies made with CopyEntity keep the setting of the entity they were copied from.

Example

EntityShadows.absOpen in editor
; Shadows example (an ArcBasic extension); S toggles shadows, Q changes the shadow quality, Escape quitsGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,6,-12TurnEntity camera,25,0,0AmbientLight 70,70,80; the sun: a directional light, pointing down at an anglesun=CreateLight(1)RotateEntity sun,50,30,0LightShadows sunground=CreatePlane()EntityColor ground,120,160,120cube=CreateCube()PositionEntity cube,-2,1,0EntityColor cube,200,80,80ball=CreateSphere(16)PositionEntity ball,2,1.5,1EntityColor ball,80,120,220; this cube neither casts nor receives shadowsghost=CreateCube()PositionEntity ghost,0,1,3EntityColor ghost,240,240,120EntityShadows ghost,False,Falseshadows=Truequality=2While Not KeyDown(1)	If KeyHit(31) ; S		shadows=Not shadows		LightShadows sun,shadows	EndIf	If KeyHit(16) ; Q		quality=(quality+1) Mod 4		ShadowQuality quality	EndIf	TurnEntity cube,0,1,0	RenderWorld	Text 0,0,"Shadows: "+shadows+"  Quality: "+quality+"  (S / Q)"	FlipWendEnd

See also