Position of child entity
Blitz3D Forums/Blitz3D Beginners Area/Position of child entity
| ||
Hi, i wonder if/how you can get the position of a child entity: My code: (How do u get those nice code fields?^^) Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() parentcube=CreateCube() PositionEntity parentcube,0,0,5 EntityColor parentcube,0,255,0 childcube=CreateCube(parentcube) PositionEntity childcube,3,0,0 EntityColor childcube,0,0,255 While Not KeyDown( 1 ) TurnEntity parentcube,1,1,1 RenderWorld Text 5,20,"X Position of child " +EntityX(childcube) Text 5,40,"Y Position of child " +EntityY(childcube) Text 5,60,"Z Position of child " +EntityZ(childcube) Text 5,80,"Yaw of child " +EntityYaw(childcube) Text 5,100,"Pitch of child " +EntityPitch(childcube) Text 5,120,"roll of child " +EntityRoll(childcube) Flip Wend End Actually i thought that i'll get the position of the child as i see it. But the text only shows me the starting position! Could anyone help me please? |
| ||
Hi elcoo, I had the same issue a while back. Found out it was to related to me not using the # global reference for the entity. I can't remember exactly how i used it, but I'm sure thats your issue. |
| ||
Use the Global flag with the EntityX/Y/Z commands etc. |
| ||
Uhm, sorry but... what exactly is a global flag? |
| ||
Look at the EntityX, EntityY etc. commands in the docs. They have an optional 'global' parameter you can set to 'True' when calling them to get the global value. Without specifying this flag, the commands default to returning local values. |
| ||
Ok, thanks! It works now. |