Outils pour utilisateurs

Outils du site


playground:picking

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révisionLes deux révisions suivantes
playground:picking [2017/05/09 02:31] falsamplayground:picking [2017/05/11 17:31] falsam
Ligne 1: Ligne 1:
 +**12-picking.sb**
 +
 +[[http://falsam.com/sbbjs/picking.html|Voir]]
 +
 +<file purebasic 12-picking.sb>
 +;Babylon.sbi - Picking
 +
 +EnableExplicit
 +
 +IncludeFile "babylon/babylon.sbi"
 +
 +Declare LoadGame()
 +Declare RenderGame()
 +
 +UseModule BJS
 +
 +InitEngine(@LoadGame())
 +
 +Procedure LoadGame()
 +  Protected Mesh
 +  
 +  If CreateScene()
 +    CreateCamera("camera", 5, 5, 10, #ArcRotate)
 +    
 +    CreateLight("Light", 0, 10, 0, 0.8, #Hemispheric)
 +    
 +    CreateGround("Sweet Ground", 10, 10)
 +    Mesh = CreateBox("My Box", 1)
 +    MoveMesh(Mesh, 0, 1, 0)
 +    
 +    Mesh = CreateSphere("Sphere", 0.5)    
 +    MoveMesh(Mesh, -2, 1, 1)
 +    
 +    Mesh = CreateCylinder("My Cylinder", 2, 1, 2)  
 +    MoveMesh(Mesh, 2, 1, -1)
 +    
 +    ;Active le systeme de picking
 +    PickEnable()
 +    
 +    RenderLoop(@RenderGame())
 +  EndIf
 +EndProcedure
 +
 +Procedure RenderGame()
 +  Protected Mesh = IsPick() 
 +  
 +  If Mesh
 +    Debug "Name " + GetMeshName(Pick\mesh)
 +    Debug "Distance from camera " + PickDistance()  
 +    Debug "x/y/z " + StrD(PickX(), 3) + " / " + StrD(PickY(), 3) + " / " + StrD(PickZ(), 3) + #CRLF$
 +    
 +  EndIf  
 +  
 +  RenderWorld() 
 +EndProcedure
 +</file>
  
playground/picking.txt · Dernière modification : 2023/03/15 15:49 de 127.0.0.1