109 lines
3.1 KiB
HTML
109 lines
3.1 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>EntityRadius entity,x_radius#[,y_radius#]</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
entity - entity handle
|
|
<br />
|
|
x_radius# - x radius of entity's collision ellipsoid
|
|
<br />
|
|
y_radius# (optional) - y radius of entity's collision ellipsoid. If omitted the x_radius# will be used for the y_radius#.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
Sets the radius of an entity's collision ellipsoid.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
An entity radius should be set for all entities involved in ellipsoidal collisions, which is all source entities (as collisions are always ellipsoid-to-something), and whatever destination entities are involved in ellipsoid-to-ellipsoid collisions (collision method No.1).
|
|
<br>
|
|
<br>
|
|
See also: <a class=small href=EntityBox.htm>EntityBox</a>, <a class=small href=Collisions.htm>Collisions</a>, <a class=small href=EntityType.htm>EntityType</a>.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../3d_examples/EntityRadius.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; EntityRadius Example
|
|
<br />
|
|
; --------------------
|
|
<br />
|
|
|
|
<br />
|
|
Graphics3D 640,480
|
|
<br />
|
|
SetBuffer BackBuffer()
|
|
<br />
|
|
|
|
<br />
|
|
camera=CreateCamera()
|
|
<br />
|
|
light=CreateLight()
|
|
<br />
|
|
|
|
<br />
|
|
sphere=CreateSphere( 32 )
|
|
<br />
|
|
PositionEntity sphere,-2,0,5
|
|
<br />
|
|
|
|
<br />
|
|
cone=CreateCone( 32 )
|
|
<br />
|
|
EntityType cone,type_cone
|
|
<br />
|
|
PositionEntity cone,2,0,5
|
|
<br />
|
|
|
|
<br />
|
|
; Set collision type values
|
|
<br />
|
|
type_sphere=1
|
|
<br />
|
|
type_cone=2
|
|
<br />
|
|
|
|
<br />
|
|
; Set sphere radius value
|
|
<br />
|
|
sphere_radius#=1
|
|
<br />
|
|
|
|
<br />
|
|
; Set sphere and cone entity types
|
|
<br />
|
|
EntityType sphere,type_sphere
|
|
<br />
|
|
EntityType cone,type_cone
|
|
<br />
|
|
|
|
<br />
|
|
; Enable collisions between type_sphere and type_cone, with ellipsoid->polygon method and slide response
|
|
<br />
|
|
Collisions type_sphere,type_cone,2,2
|
|
<br />
|
|
|
|
<br />
|
|
While Not KeyDown( 1 )
|
|
<br />
|
|
|
|
<br />
|
|
x#=0
|
|
<br />
|
|
y#=0
|
|
<br />
|
|
z#=0
|
|
<br />
|
|
|
|
<br />
|
|
If KeyDown( 203 )=True Then x#=-0.1
|
|
<br />
|
|
If KeyDown( 205 )=True Then x#=0.1
|
|
<br />
|
|
If KeyDown( 208 )=True Then y#=-0.1
|
|
<br />
|
|
If KeyDown( 200 )=True Then y#=0.1
|
|
<br />
|
|
If KeyDown( 44 )=True Then z#=-0.1
|
|
<br />
|
|
If KeyDown( 30 )=True Then z#=0.1
|
|
<br />
|
|
|
|
<br />
|
|
MoveEntity sphere,x#,y#,z#
|
|
<br />
|
|
|
|
<br />
|
|
; If square brackets keys pressed then change sphere radius value
|
|
<br />
|
|
If KeyDown( 26 )=True Then sphere_radius#=sphere_radius#-0.1
|
|
<br />
|
|
If KeyDown( 27 )=True Then sphere_radius#=sphere_radius#+0.1
|
|
<br />
|
|
|
|
<br />
|
|
; Set entity radius of sphere
|
|
<br />
|
|
EntityRadius sphere,sphere_radius#
|
|
<br />
|
|
|
|
<br />
|
|
; Perform collision checking
|
|
<br />
|
|
UpdateWorld
|
|
<br />
|
|
|
|
<br />
|
|
RenderWorld
|
|
<br />
|
|
|
|
<br />
|
|
Text 0,0,"Use cursor/A/Z keys to move sphere"
|
|
<br />
|
|
Text 0,20,"Press [ or ] to change EntityRadius radius_x# value"
|
|
<br />
|
|
Text 0,40,"EntityRadius sphere,"+sphere_radius
|
|
<br />
|
|
|
|
<br />
|
|
Flip
|
|
<br />
|
|
|
|
<br />
|
|
Wend
|
|
<br />
|
|
|
|
<br />
|
|
End
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=EntityRadius&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|