MousePick() No work with PB_Any entity
Posted: Tue Aug 12, 2025 12:45 pm
(MOVED FROM 3D PROGRAMMING)
Hello, im trying to use PickMouse over 6.21 and return wrong Entity..
Any body can test it and confirm if is a bug?
Return this
CUBE: 2152618004016
Entity clicked: 2147483647
If use a number, not #PB_any, all work fine, but with #PB_any MouseClick() return unknown id (unknown for me)
How you can see are diferent.
Here the code to test. Thanks.
Hello, im trying to use PickMouse over 6.21 and return wrong Entity..
Any body can test it and confirm if is a bug?
Return this
CUBE: 2152618004016
Entity clicked: 2147483647
If use a number, not #PB_any, all work fine, but with #PB_any MouseClick() return unknown id (unknown for me)

How you can see are diferent.
Here the code to test. Thanks.
Code: Select all
InitEngine3D(#PB_Engine3D_DebugLog):InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0,0, 1280,720, "Pick test",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0),WindowHeight(0), 0, 0, 0)
CreateCamera(0,0,0,100,100):MoveCamera(0,0,5,-20,#PB_Absolute):CameraLookAt(0,0,5,0):CameraBackColor(0,$332211)
CreateLight(0,$ffffff,3,3,3)
s= CreateSprite(#PB_Any,30,30,#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(s)):Box(0,0,OutputWidth(),OutputHeight(),$ff0000):StopDrawing()
e= CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(CreateMaterial(#PB_Any,#Null,$ff0000)))
Debug "CUBE: "+Str(e)
Repeat
While WindowEvent():Wend
ExamineMouse(): ExamineKeyboard()
If MouseButton(#PB_MouseButton_Left)
If Not lmb
lmb=1
e= MousePick(0,MouseX(),MouseY())
Debug "Entity clicked: "+Str(e)
If e>-1
EndIf
EndIf
Else
lmb=0
EndIf
renderTime= RenderWorld()
DisplayTransparentSprite(s,MouseX(),MouseY())
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)