Outils pour utilisateurs

Outils du site


playground:collision

Ceci est une ancienne révision du document !


05-Collision.sb

Voir

05-Collision.sb
;Babylon.sbi - Collision
 
EnableExplicit
 
IncludeFile "babylon/babylon.sbi"
 
Global n, Camera, Light, Ground, Sphere0, Sphere1, Sphere2, Sphere3
 
Declare LoadGame()
Declare RenderGame()
 
UseModule BJS
 
InitEngine(@LoadGame())
 
Procedure LoadGame()    
  If CreateScene()
    EnablePhysics()
 
    CreateCamera("camera", 0, 20, 30, #BJS_ArcRotate)
    Light = CreateLight("light", 5, 10, 0, 1, #BJS_Point)
 
    Sphere0 = CreateSphere("Sphere", 1)
    MoveMesh(Sphere0, 0, 30, 0)
 
    Sphere1 = CreateSphere("Sphere", 2)
    MoveMesh(Sphere1, 0.5, 32, 0)
 
    Sphere2 = CreateSphere("Sphere", 1.5)
    MoveMesh(Sphere2, 2, 30, 2)
 
    Sphere3 = CreateSphere("Sphere", 3)
    MoveMesh(Sphere3, 4, 30, -4)
 
    Ground = CreateGround("Ground", 30, 30) 
 
    CreateBody(Sphere0, #SphereBody, 1, 0.5, 0.5)
    CreateBody(Sphere1, #SphereBody, 1, 0.5, 0.6)
    CreateBody(Sphere2, #SphereBody, 1, 0.5, 0.7)    
    CreateBody(Sphere3, #SphereBody, 1, 0.5, 0.8)    
    CreateBody(Ground,  #BoxBody, 0, 1, 1)
 
    RenderLoop(@RenderGame())
  EndIf
EndProcedure
 
Procedure RenderGame()
  RenderWorld() 
EndProcedure
playground/collision.1515632078.txt.gz · Dernière modification : 2023/03/15 15:51 (modification externe)