How do you get a mesh's size (X, Y, Z)?
I want to be able to return the correct sizes in seperate functions.
Mesh Size?
- Bananenfreak
- Enthusiast
- Posts: 519
- Joined: Mon Apr 15, 2013 12:22 pm
Re: Mesh Size?
How would I do this? I'm new to bounding boxes.
Re: Mesh Size?
Contributor : Comtois
http://www.forums.purebasic.com/english ... 36&t=55959
PS : RenderWorld() should be called before debug
http://www.forums.purebasic.com/english ... 36&t=55959
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
Last edited by falsam on Mon Sep 16, 2013 6:06 pm, edited 2 times in total.
➽ Windows 11 64-bit - PB 6.0 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect.
Re: Mesh Size?
Thank you very much, Falsam! =) This is PERFECT!