AttachEntityObject() - Bug?

Everything related to 3D programming
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: AttachEntityObject() - Bug?

Post by applePi »

i think it is a bug , i have reported it here http://www.purebasic.fr/english/viewtop ... =4&t=57304
the demo posted there create Entity(0), and Entity(1), then scale Entity(0) to (1, 0.2, 1)
but when we attach Entity(1) to the scaled down Entity(0) the Entity(1) also is scaled down like Entity(0)
this should be happened after the attachment happend and not before else how can we construct complex constructions and different shapes attached together !!
it is possible that this bug is the reason why the attached entity have poor physics as reported here http://www.purebasic.fr/english/viewtop ... 36&t=56083 (How apply physic on AttachEntityObject ?)

Edit:
Edit:
this is the only way to attach Entity(1) as we want
ScaleEntity(0, 1, 0.2, 1)
ScaleEntity(1, 1, 5, 1)

ie to scale Entity(1) 5 times on the Y , so when it is scaled down by 0.2 by the engine it will return 1

Code: Select all

;
;   PureBasic - Text3D
;
;    (c) 2012 - Fantaisie Software
;
; ------------------------------------------------------------
;

IncludeFile "Screen3DRequester.pb"


If InitEngine3D()
  
  Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive("Data/fonts", #PB_3DArchive_FileSystem)
  Parse3DScripts()
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    CreateCube(0, 2)
    CreateCube(1, 2)
    
    
    CreateMaterial(0, LoadTexture(0, "Caisse.png"))
    CreateMaterial(1, LoadTexture(1, "Wood.jpg"))
    
    CreateEntity(0, MeshID(0), MaterialID(0))
    CreateEntity(1, MeshID(1), MaterialID(1),3,1,0)
    
    ScaleEntity(0, 1, 0.2, 1)
    ScaleEntity(1, 1, 5, 1)
    
    CreateText3D(0, "Hello world")
    Text3DColor(0, RGBA(255, 0, 0, 255))
    Text3DAlignment(0, #PB_Text3D_HorizontallyCentered)
    
    AttachEntityObject(0, "", Text3DID(0))
    AttachEntityObject(0, "", EntityID(1))
    ;ScaleEntity(0, 1, 1, 1)
    ;ScaleEntity(0,1,0.2,1) ; the same behaviour
    MoveText3D(0, 0, 2, 2)

    RotateEntity(0, 0, -70, 0)
    
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 0, 0, 10, #PB_Absolute)
    
    Repeat
      Screen3DEvents()
      
      ExamineKeyboard()
      
      RotateEntity(0, 1, 1, 1, #PB_Relative)
      
      RenderWorld()
      Screen3DStats()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End