dxEntityRadius(entity%,radius_x#,radius_y#)

Parameters

entity - entity handle
x_radius# - x radius of entity's collision ellipsoid
y_radius# (optional) - y radius of entity's collision ellipsoid. If omitted the x_radius# will be used for the y_radius#.

Description

Sets the radius of an entity's collision ellipsoid.

An entity radius should be set for all entities involved in ellipsoidal dxCollisions, which is all source entities (as dxCollisions are always ellipsoid-to-something), and whatever destination entities are involved in ellipsoid-to-ellipsoid dxCollisions (collision method No.1).

See also: dxEntityBox, dxCollisions, dxEntityType.

Example

; dxEntityRadius Example
; --------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()
light=dxCreateLight()

sphere=dxCreateSphere( 32 )
dxPositionEntity sphere,-2,0,5

cone=dxCreateCone( 32 )
dxEntityType cone,type_cone
dxPositionEntity cone,2,0,5

; Set collision type values
type_sphere=1
type_cone=2

; Set sphere radius value
sphere_radius#=1

; Set sphere and cone entity types
dxEntityType sphere,type_sphere
dxEntityType cone,type_cone

; Enable dxCollisions between type_sphere and type_cone, with ellipsoid->polygon method and slide response
dxCollisions type_sphere,type_cone,2,2

While Not dxKeyDown( 1 )

x#=0
y#=0
z#=0

If dxKeyDown( 203 )=True Then x#=-0.1
If dxKeyDown( 205 )=True Then x#=0.1
If dxKeyDown( 208 )=True Then y#=-0.1
If dxKeyDown( 200 )=True Then y#=0.1
If dxKeyDown( 44 )=True Then z#=-0.1
If dxKeyDown( 30 )=True Then z#=0.1

dxMoveEntity sphere,x#,y#,z#

; If square brackets keys pressed then change sphere radius value
If dxKeyDown( 26 )=True Then sphere_radius#=sphere_radius#-0.1
If dxKeyDown( 27 )=True Then sphere_radius#=sphere_radius#+0.1

; Set entity radius of sphere
dxEntityRadius sphere,sphere_radius#

; Perform collision checking
dxUpdateWorld

dxRenderWorld

dxText 0,0,"Use cursor/A/Z keys to move sphere"
dxText 0,20,"Press [ or ] to change dxEntityRadius radius_x# value"
dxText 0,40,"dxEntityRadius sphere,"+sphere_radius

dxFlip

Wend

End

Index