CheckObjectVisibility()
Syntax
Result = CheckObjectVisibility(#Camera, ObjectID)Description
Checks if an object is visible within a camera view.
Parameters
#Camera The camera to use. ObjectID The object to check. It can be one of the following type: - Entity : use EntityID() to get a valid ID. - Light : use LightID() to get a valid ID. - Node : use NodeID() to get a valid ID. - ParticleEmitter: use ParticleEmitterID() to get a valid ID. - BillboardGroup : use BillboardGroupID() to get a valid ID. - Text3D : use Text3DID() to get a valid ID.
Return value
Returns #True if object is within the selected camera view or #False if outside the visible area.
Example
InitEngine3D() InitSprite() InitKeyboard() OpenWindow(0, 0, 0, 800, 600, "Object Visibility (Use arrows <-- --> and ESC to quit)", #PB_Window_ScreenCentered) OpenWindowedScreen(WindowID(0),0, 0, 800, 600) CreateCamera(0, 0, 0, 100, 100) CreateCube(0, 1) CreateTexture(0, 100, 100) If StartDrawing(TextureOutput(0)) DrawingMode(#PB_2DDrawing_Gradient) CircularGradient(50, 50, 48) Circle(50, 50, 48) StopDrawing() EndIf CreateMaterial(0, TextureID(0)) ScaleMaterial(0, 0.1, 0.1) CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, -2) Repeat Repeat : Event = WindowEvent() : Until Event = 0 RenderWorld() RotateEntity(0, 0.1, -0.3, 0.3, #PB_Relative) ExamineKeyboard() If KeyboardPushed(#PB_Key_Left) MoveEntity(0, -0.1, 0, 0,#PB_Relative) ElseIf KeyboardPushed(#PB_Key_Right) MoveEntity(0, 0.1, 0, 0,#PB_Relative) EndIf If CheckObjectVisibility(0, EntityID(0)) = #False Debug "Can't see the object anymore" Else Debug "I see it !" EndIf FlipBuffers() Until KeyboardPushed(#PB_Key_Escape)
Supported OS
All