Hi all,
I have a question.
To move an entity, there's MoveEntity. The movement of an entity is affected by collisions, if set.
So, to place an entity in an arbitrary point in the 3D world, without being affected by collisions, there is the command PositionEntity, right ?
So, with PositionEntity I can place the entity in any place in the world, even if from the start position x,y,z and the final position x1,y1,z1 there's some obstacle.
Am I right, or am I missing something here ?
Then, run the example below, and move the EntityType command before or after the PositionEntity command (both for the sphere).
You will see that when EntityType is placed after positionentity, then the sphere will be correctly placed at the left side of the 'wall'.
Instead, when the EntityType command is used before the positionentity one, then the sphere will remain at 0,0,0.
Could someone enlight me if this is a correct behaviour ?
Thanks,
Sergio.
P.S.
Using B3D 1.83
I have a question.
To move an entity, there's MoveEntity. The movement of an entity is affected by collisions, if set.
So, to place an entity in an arbitrary point in the 3D world, without being affected by collisions, there is the command PositionEntity, right ?
So, with PositionEntity I can place the entity in any place in the world, even if from the start position x,y,z and the final position x1,y1,z1 there's some obstacle.
Am I right, or am I missing something here ?
Then, run the example below, and move the EntityType command before or after the PositionEntity command (both for the sphere).
You will see that when EntityType is placed after positionentity, then the sphere will be correctly placed at the left side of the 'wall'.
Instead, when the EntityType command is used before the positionentity one, then the sphere will remain at 0,0,0.
Could someone enlight me if this is a correct behaviour ?
Thanks,
Sergio.
P.S.
Using B3D 1.83
;code =========================================================== Graphics3D 640,480,0,2 Const E_GROUND = 1 Const E_OBJECT = 2 Global camera = CreateCamera() CameraRange camera,0.1,1000 PositionEntity camera,0,0.5,-5 cube = CreateCube() tex = CreateTexture(32,32) SetBuffer TextureBuffer(tex) Color 255,0,0 Rect 0,0,30,30 Color 255,255,255 Text 0,10,"WALL" SetBuffer BackBuffer() EntityTexture cube,tex ;EntityColor cube,200,0,0 ScaleEntity cube,0.6,0.6,3 PositionEntity cube,-1,0,0 EntityType cube, E_GROUND ;assign entity type ground to the 'wall' Collisions E_OBJECT,E_GROUND,2,1 ;set up collisions between object type and ground type sphere = CreateSphere() ;this creates a sphere at 0,0,0 scale# = 0.3 ScaleEntity sphere,scale,scale,scale EntityColor sphere,0,200,0 EntityRadius sphere,scale ;if you move this entitytype statement AFTER the positionentity one, then the sphere will be correctly placed EntityType sphere,E_OBJECT ;when Entitytype is before this statement, the sphere will remain at 0,0,0 PositionEntity sphere,-4, 0, 0 While Not KeyDown(1) UpdateWorld RenderWorld Text 0,0,"Sphere position: " + EntityX(sphere) + " ; " + EntityY(sphere) + " ; " + EntityZ(sphere) Flip Wend End ;end code ====================================================================================