Mesh Size?
Posted: Mon Sep 16, 2013 3:28 pm
How do you get a mesh's size (X, Y, Z)?
I want to be able to return the correct sizes in seperate functions.
I want to be able to return the correct sizes in seperate functions.
Code: Select all
InitEngine3D()
InitKeyboard()
InitSprite()
window = OpenWindow(#PB_Any,0,0,1024,768,"Entity Size")
OpenWindowedScreen(WindowID(window),0,0,1024,768)
Camera = CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(Camera, 0, 5, 3)
CameraLookAt(camera,0,0,0)
Mesh = CreateCube(#PB_Any, 1)
Entity = CreateEntity(#PB_Any, MeshID(Mesh), #PB_Material_None , 0, 0, 0)
ScaleEntity(Entity, 2, 1, 5)
GetEntitySize = #True
While #True
Event = WindowEvent()
ExamineKeyboard()
If Event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
Break
EndIf
ClearScreen(RGB(0, 0, 0))
RenderWorld()
If GetEntitySize = #True
Debug "X : " + Str(EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxX | #PB_Entity_WorldBoundingBox) / EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxX | #PB_Entity_LocalBoundingBox))
Debug "Y : " + Str(EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxY | #PB_Entity_WorldBoundingBox) / EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxY | #PB_Entity_LocalBoundingBox))
Debug "Z : " + Str(EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxZ | #PB_Entity_WorldBoundingBox) / EntityBoundingBox(Entity, #PB_Entity_MinBoundingBoxZ | #PB_Entity_LocalBoundingBox))
GetEntitySize = #False
EndIf
FlipBuffers()
Wend