Page 1 of 1

AttachEntityObject() coordinates are ignored

Posted: Fri Nov 23, 2018 8:26 pm
by Psychophanta
Take a look to this one.
just run it as it is.
Then uncomment the remarked lines and comment the other 2 ones, then run again.
The result is different and i suspect AttachEntityObject() coordinates parameters are ignored.

Code: Select all

RX.u=1024:RY.u=768
InitEngine3D()
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,RX,RY,"tip",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,0,0,0,#PB_Screen_WaitSynchronization)
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,3,#PB_Absolute)
LoadTexture(0,"terrain_detail.jpg")
CreateMaterial(0,TextureID(0))
CreateCylinder(0,0.2,1)
CreateSphere(1,0.2)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)

;These 2 lines does work because coordinates in parameters for CreateEntity() are performed:
CreateEntity(2,MeshID(1),MaterialID(0),1,0,0)
AttachEntityObject(0,"",EntityID(2))

;These 2 lines does not work because coordinates in the parameters of AttachEntityObject() are ignored:
; CreateEntity(2,MeshID(1),MaterialID(0))
; AttachEntityObject(0,"",EntityID(2),1,0,0,0,0,0)

Repeat
  WaitWindowEvent()
  ExamineKeyboard()
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)

Re: AttachEntityObject() coordinates are ignored

Posted: Sat Nov 24, 2018 10:29 am
by DK_PETER
True..The AttachEntityObject() parameters are ignored.

Re: AttachEntityObject() coordinates are ignored

Posted: Sat Nov 24, 2018 3:34 pm
by Comtois
position and rotation are used by bones.

You can use MoveEntity()

Code: Select all

 CreateEntity(2,MeshID(1),MaterialID(0))
 AttachEntityObject(0,"",EntityID(2))
 MoveEntity(2,1,0,0)

Re: AttachEntityObject() coordinates are ignored

Posted: Sat Nov 24, 2018 6:16 pm
by Psychophanta
Comtois wrote:position and rotation are used by bones.

You can use MoveEntity()

Code: Select all

 CreateEntity(2,MeshID(1),MaterialID(0))
 AttachEntityObject(0,"",EntityID(2))
 MoveEntity(2,1,0,0)
I suspected just that. However there would be necessary a note about it in the manual.

Instead to add a MoveEntity() command it can be done in the CreateEntity() position parameters:

Code: Select all

 CreateEntity(2,MeshID(1),MaterialID(0),1,0,0)
 AttachEntityObject(0,"",EntityID(2))