AttachEntityObject() coordinates are ignored

Everything related to 3D programming
User avatar
Psychophanta
Addict
Addict
Posts: 4997
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

AttachEntityObject() coordinates are ignored

Post 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)
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
DK_PETER
Addict
Addict
Posts: 898
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Re: AttachEntityObject() coordinates are ignored

Post by DK_PETER »

True..The AttachEntityObject() parameters are ignored.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
User avatar
Comtois
Addict
Addict
Posts: 1429
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: AttachEntityObject() coordinates are ignored

Post 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)
Please correct my english
http://purebasic.developpez.com/
User avatar
Psychophanta
Addict
Addict
Posts: 4997
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: AttachEntityObject() coordinates are ignored

Post 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))
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply