entity - name of entity to be positioned x# - x co-ordinate that entity will be positioned at y# - y co-ordinate that entity will be positioned at z# - z co-ordinate that entity will be positioned at global (optional) - true if the position should be relative to 0,0,0 rather than a parent entity's position. False by default. |
Positions an entity at an absolute position in 3D space. 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. Of course, the direction in which entities appear to move is relative to the position and orientation of the camera. See also: dxMoveEntity, dxTranslateEntity, dxPositionMesh. |
; dxPositionEntity Example ; ---------------------- dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() light=dxCreateLight() cone=dxCreateCone( 32 ) ; Set position values so that cone is positioned in front of camera, so we can see it to begin with x#=0 y#=0 z#=10 While Not dxKeyDown( 1 ) ; Change position values depending on key pressed If dxKeyDown( 203 )=True Then x#=x#-0.1 If dxKeyDown( 205 )=True Then x#=x#+0.1 If dxKeyDown( 208 )=True Then y#=y#-0.1 If dxKeyDown( 200 )=True Then y#=y#+0.1 If dxKeyDown( 44 )=True Then z#=z#-0.1 If dxKeyDown( 30 )=True Then z#=z#+0.1 ; Position cone using position values dxPositionEntity cone,x#,y#,z# dxRenderWorld dxText 0,0,"Use cursor/A/Z keys to change cone position" dxText 0,20,"X Position: "+x# dxText 0,40,"Y Position: "+y# dxText 0,60,"Z Position: "+z# dxFlip Wend End |