The code says it all.
When turning entity without touching the mes, all is ok, but when transform the mesh , it does not transform its bounding shape.
Code: Select all
InitEngine3D():InitSprite():InitKeyboard()
RX.u=1280:RY.u=720
OpenWindow(0,0,0,RX,RY,"",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point):SetLightColor(0,#PB_Light_DiffuseColor,$EEEEEE):MoveLight(0,4,4,2,#PB_Absolute):AmbientColor($FFFFFF)
LoadTexture(0,"wood.jpg"):CreateMaterial(0,TextureID(0))
CreateCube(0,10):TransformMesh(0,0,0,0,2,0.01,2,0,0,0,0):UpdateMeshBoundingBox(0)
CreateEntity(0,MeshID(0),MaterialID(0),0,-0.05,0)
CreateEntityBody(0,#PB_Entity_StaticBody,1.0,0.8,0.3)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,3,5)
Cameralookat(0,0,1,0)
LoadTexture(1,"RustySteel.jpg")
CreateMaterial(1,TextureID(1))
WorldDebug(#PB_World_DebugBody)
Repeat
ExamineKeyboard()
WindowEvent()
If KeyboardReleased(#PB_Key_Space):way.b!1
If IsEntity(1):FreeEntityBody(1):FreeEntity(1):EndIf
If IsMesh(1):FreeMesh(1):EndIf
CreateCone(1,0.2,1,16,8)
If way
UpdateMeshBoundingBox(1)
CreateEntity(1,MeshID(1),MaterialID(1),0,0.5,0)
RotateEntity(1,0,0,180)
Else
; This way does not work!!: ?
TransformMesh(1,0,0,0,1,1,1,0,0,180):UpdateMeshBoundingBox(1)
CreateEntity(1,MeshID(1),MaterialID(1),0,0.5,0)
EndIf
CreateEntityBody(1,#PB_Entity_ConeBody,1,0.4,0.2):SetEntityAttribute(1,#PB_Entity_LinearSleeping,0.01):SetEntityAttribute(1,#PB_Entity_AngularSleeping,2.2)
EndIf
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)