| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>PositionEntity entity,x#,y#,z#,[,global]</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- entity - name of entity to be positioned
<br />
- x# - x co-ordinate that entity will be positioned at
<br />
- y# - y co-ordinate that entity will be positioned at
<br />
- z# - z co-ordinate that entity will be positioned at
<br />
- global (optional) - true if the position should be relative to 0,0,0 rather than a parent entity's position. False by default.
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- Positions an entity at an absolute position in 3D space.
<br />
-
<br />
- Entities are positioned using an x,y,z coordinate system. x, y and z each have their own axis, and each axis has its own set of values. By specifying a value for each axis, you can position an entity anywhere in 3D space. 0,0,0 is the centre of 3D space, and if the camera is pointing in the default positive z direction, then positioning an entity with a z value of above 0 will make it appear in front of the camera, whereas a negative z value would see it disappear behind the camera. Changing the x value would see it moving sideways, and changing the y value would see it moving up/down.
<br />
-
<br />
- Of course, the direction in which entities appear to move is relative to the position and orientation of the camera.
- <br>
- <br>
- See also: <a class=small href=MoveEntity.htm>MoveEntity</a>, <a class=small href=TranslateEntity.htm>TranslateEntity</a>, <a class=small href=PositionMesh.htm>PositionMesh</a>.
- </td>
- </tr>
- </table>
- <h1><a href=../3d_examples/PositionEntity.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; PositionEntity Example
<br />
- ; ----------------------
<br />
-
<br />
- Graphics3D 640,480
<br />
- SetBuffer BackBuffer()
<br />
-
<br />
- camera=CreateCamera()
<br />
- light=CreateLight()
<br />
-
<br />
- cone=CreateCone( 32 )
<br />
-
<br />
- ; Set position values so that cone is positioned in front of camera, so we can see it to begin with
<br />
- x#=0
<br />
- y#=0
<br />
- z#=10
<br />
-
<br />
- While Not KeyDown( 1 )
<br />
-
<br />
- ; Change position values depending on key pressed
<br />
- If KeyDown( 203 )=True Then x#=x#-0.1
<br />
- If KeyDown( 205 )=True Then x#=x#+0.1
<br />
- If KeyDown( 208 )=True Then y#=y#-0.1
<br />
- If KeyDown( 200 )=True Then y#=y#+0.1
<br />
- If KeyDown( 44 )=True Then z#=z#-0.1
<br />
- If KeyDown( 30 )=True Then z#=z#+0.1
<br />
-
<br />
- ; Position cone using position values
<br />
- PositionEntity cone,x#,y#,z#
<br />
-
<br />
- RenderWorld
<br />
-
<br />
- Text 0,0,"Use cursor/A/Z keys to change cone position"
<br />
- Text 0,20,"X Position: "+x#
<br />
- Text 0,40,"Y Position: "+y#
<br />
- Text 0,60,"Z Position: "+z#
<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=PositionEntity&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|