Page 1 sur 2

[PB 5.10b2] - Explosions + Physique

Publié : lun. 14/janv./2013 17:09
par kelebrindae
Salut à tous!

Voici un petit bout de code permettant de "simuler" grossièrement une explosion avec le moteur physique de PB (juste la physique, pas le côté graphique).
En bref, ça crée une sphère qui grandit progressivement en repoussant les objets alentours comme le ferait le souffle d'une explosion. Très sommaire, mais pour un jeu d'arcade ça peut suffire.

Au moment de la création de l'explosion, on spécifie la taille finale de l'explosion et le temps qu'elle mettra pour atteindre cette taille.
Bougez la petite sphère blanche avec la souris, clic gauche pour déclencher l'explosion.

Remarques:
- En passant en 5.10, j'ai perdu les ombres des objets :? . Quelqu'un sait pourquoi ?
- Le code plante en 5.10b3 sur le ResizeEntity (Invalid Memory Access) => j'essaierai de faire un rapport de bug sur le forum anglais.

A+

Code : Tout sélectionner

;- Press "W" to toggle wireframe display
;- Press "P" to toggle physics bodies display

; Window size
#SCREENWIDTH = 800
#SCREENHEIGHT = 500


Structure explo_struct
  x.f
  y.f
  z.f
 
  entity.i
 
  size.f
  sizeMax.f
 
  duration.i
  durationMax.i
EndStructure
Global NewList explo.explo_struct()

Global sphereMesh.i, mtExplo.i


; Create an explosion
Procedure createExplosion(x.f,y.f,z.f,size.f,duration.i)
  AddElement(explo())
  explo()\x = x
  explo()\y = y
  explo()\z = z
  explo()\sizeMax = size
  explo()\durationMax = duration 
EndProcedure


; Manage the existing explosions
Procedure manageExplosion()
  ForEach explo()
    If IsEntity(explo()\entity)
      If explo()\duration = explo()\durationMax
        FreeEntity(explo()\entity)
        DeleteElement(explo())
        Continue
      EndIf
    Else
      explo()\entity = CreateEntity(#PB_Any,MeshID(sphereMesh),MaterialID(mtExplo),explo()\x,explo()\y,explo()\z)     
      ;HideEntity(explo()\entity,#True)
      EntityPhysicBody(explo()\entity,#PB_Entity_SphereBody,999,0,0)
    EndIf
   
    explo()\duration+1
    explo()\size = explo()\sizeMax * (Sin((#PI/2) * explo()\duration / explo()\durationMax))
   
    ResizeEntity(explo()\entity,explo()\size,explo()\size,explo()\size)
    MoveEntity(explo()\entity,explo()\x,explo()\y,explo()\z,#PB_Absolute)
   
  Next explo() 
EndProcedure


;- Initialization
InitEngine3D()
InitSprite()
InitMouse()
InitKeyboard()

;- Window
OpenWindow(0, 0, 0, #SCREENWIDTH, #SCREENHEIGHT, "physics test", #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, #SCREENWIDTH,#SCREENHEIGHT, 0, 0, 0,#PB_Screen_SmartSynchronization)

;-Texture
txBlank = CreateTexture(#PB_Any,4,4)
StartDrawing(TextureOutput(txBlank))
  Box(0, 0, 4,4, $FFFFFF)
StopDrawing()

txTerrain = CreateTexture(#PB_Any,256, 256)
StartDrawing(TextureOutput(txTerrain))
  Box(0, 0, 256, 256, $007700)
  Line(0,256,256,-256, $00BB00)
StopDrawing()

;-Materials
mtTerrain = CreateMaterial(#PB_Any,TextureID(txTerrain))

mtGlass = CreateMaterial(#PB_Any,TextureID(txBlank))
SetMaterialColor(mtGlass,#PB_Material_DiffuseColor,$BBBB00)
MaterialBlendingMode(mtGlass, #PB_Material_Add)

mtRed = CreateMaterial(#PB_Any,TextureID(txBlank))
SetMaterialColor(mtRed,#PB_Material_DiffuseColor,$0000FF)

mtExplo = CreateMaterial(#PB_Any,TextureID(txBlank))
SetMaterialColor(mtExplo,#PB_Material_DiffuseColor,$002233)
MaterialBlendingMode(mtExplo, #PB_Material_Add)

;- Meshes
dimX.f = 50:dimY.f = 50
planeMesh = CreatePlane(#PB_Any,dimX,dimY,1,1,1,1)
cubeMesh = CreateCube(#PB_Any,1)
sphereMesh = CreateSphere(#PB_Any,1)

;- Entities
; Terrain
sol = CreateEntity(#PB_Any, MeshID(planeMesh), MaterialID(mtTerrain),0,0.2,0)
EntityPhysicBody(sol, #PB_Entity_StaticBody,999,0,0.2)

; Barriers
barrierHeight.f = 10:barrierWidth.f = 0.5

barrier1 = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtGlass),0,barrierHeight / 2,-(dimY / 2 + barrierWidth / 2),0)
ScaleEntity(barrier1,dimX,barrierHeight,barrierWidth)
EntityPhysicBody(barrier1, #PB_Entity_BoxBody,0,0.5,0)

barrier2 = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtGlass),0,barrierHeight / 2,(dimY / 2 + barrierWidth / 2),0)
ScaleEntity(barrier2,dimX,barrierHeight,barrierWidth)
EntityPhysicBody(barrier2, #PB_Entity_BoxBody,0,0.5,0)

barrier3 = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtGlass),-(dimX / 2 + barrierWidth / 2),barrierHeight / 2,0,0)
ScaleEntity(barrier3,barrierWidth,barrierHeight,dimY)
EntityPhysicBody(barrier3, #PB_Entity_BoxBody,0,0.5,0)

barrier4 = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtGlass),(dimX / 2 + barrierWidth / 2),barrierHeight / 2,0,0)
ScaleEntity(barrier4,barrierWidth,barrierHeight,dimY)
EntityPhysicBody(barrier4, #PB_Entity_BoxBody,0,0.5,0)

; Boxes
For i = 1 To 200
  box = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtRed), (dimX/2 - Random(dimX))*0.9, barrierHeight+Random(10), (dimY/2 - Random(dimY))*0.9,0)
  EntityPhysicBody(box,#PB_Entity_BoxBody)
Next i

; Mouse pointer
pointer = CreateEntity(#PB_Any,MeshID(sphereMesh),#PB_Material_None)

;- Camera
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0,0,50,50,#PB_Absolute)
CameraLookAt(0,0,0,0)

;-Light
AmbientColor($333333)
light = CreateLight(#PB_Any,$FFFFFF,20,40,20)
WorldShadows(#PB_Shadow_Additive)

;- Main loop
wireframe.b = #False
physics.b = #False


KeyboardMode(#PB_Keyboard_International)
Repeat
  Delay(1)
  While WindowEvent() : Wend

  ; Activate wireframe/physics render
  ExamineKeyboard()
  If KeyboardReleased(#PB_Key_W)
    wireframe = 1-wireframe
    If wireframe = #True
      CameraRenderMode(0,#PB_Camera_Wireframe)
    Else
      CameraRenderMode(0,#PB_Camera_Textured)
    EndIf
  EndIf
  If KeyboardReleased(#PB_Key_P)
    physics = 1-physics
    If physics = #True
      WorldDebug(#PB_World_DebugBody)
    Else
      WorldDebug(#PB_World_DebugNone)
    EndIf
  EndIf
   
  ; Mouse pointer
  ExamineMouse()
  If MousePick(0, MouseX(), MouseY()) = sol
    MoveEntity(pointer, PickX(), PickY(), PickZ(),#PB_Absolute)
  EndIf
  If MouseButton(#PB_MouseButton_Left)
    If click = #False
      createExplosion(EntityX(pointer),EntityY(pointer),EntityZ(pointer),8,20)
      click = #True
    EndIf
  Else
    click = #False
  EndIf
 
  ; Explosions
  manageExplosion()
 
  ; Render
  RenderWorld()
  FlipBuffers()

Until KeyboardPushed(#PB_Key_Escape)

End

Re: [PB 5.10b2] - Explosions + Physique

Publié : lun. 14/janv./2013 17:38
par comtois
Le code plante en 5.10b3 sur le ResizeEntity (Invalid Memory Access)
C'est supprimé à partir de la b3 il faut utiliser ScaleEntity() avec l'option #PB_Absolute. C'est dans la doc anglaise. Par contre Fred a oublié de faire le wrap donc ça ne marchera pas. faut attendre la b4,s'il n'oublie pas à nouveau :)


[EDIT]
Je viens de tester, belle idée. C'est toujours utile d'avoir des trucs et astuces de ce genre.

Pour les ombres, on a rien changé sauf la mise à jour d'ogre. Je viens de comparer avec la version 5.0 il n'y a pas d'ombres non plus.

Re: [PB 5.10b2] - Explosions + Physique

Publié : lun. 14/janv./2013 21:30
par kelebrindae
comtois a écrit :Pour les ombres, on a rien changé sauf la mise à jour d'ogre. Je viens de comparer avec la version 5.0 il n'y a pas d'ombres non plus.
8O Ah bon? Je me fais vieux, moi; je commence à dérailler...

Mais qu'est-ce que j'ai raté, alors? Comment ça se fait qu'il n'y ait pas d'ombres?

Re: [PB 5.10b2] - Explosions + Physique

Publié : lun. 14/janv./2013 22:09
par Cool Dji
Hello,

Merci Kelebrindae, sympa l'exemple !

Re: [PB 5.10b2] - Explosions + Physique

Publié : lun. 14/janv./2013 23:24
par comtois
kelebrindae a écrit :
comtois a écrit :Pour les ombres, on a rien changé sauf la mise à jour d'ogre. Je viens de comparer avec la version 5.0 il n'y a pas d'ombres non plus.
8O Ah bon? Je me fais vieux, moi; je commence à dérailler...

Mais qu'est-ce que j'ai raté, alors? Comment ça se fait qu'il n'y ait pas d'ombres?
Aucune idée, je ne vois pas ce qui cloche. Faudrait repartir d'un exemple qui fonctionne avec les ombres et le modifier progressivement jusqu'à obtenir ton exemple en vérifiant à chaque étape ce qui se passe.

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 17:00
par kelebrindae
J'ai mis longtemps à trouver, mais tu vas rire: c'est le paramètre "PickMask" de "CreateEntity" qui provoque la disparition des ombres. 8O

En effet, si je remplace:

Code : Tout sélectionner

  box = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtRed), (dimX/2 - Random(dimX))*0.9, barrierHeight+Random(10), (dimY/2 - Random(dimY))*0.9,0)
par:

Code : Tout sélectionner

  box = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtRed), (dimX/2 - Random(dimX))*0.9, barrierHeight+Random(10), (dimY/2 - Random(dimY))*0.9)
(J'ai juste enlevé le PickMask), les ombres refont leur apparition.
Etonnant, non?

Plus étonnant encore: le PickMask affecte le BlendingMode des materials.
Sur l'entity "barrier2" (celle du premier plan), si je mets un PickMask différent de zéro, ou si je supprime ce paramètre, on ne voit plus les objets au travers de la même façon qu'avant. :|
Bizarre, bizarre...

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 17:05
par falsam
Étonnant mais le but est atteint. Merci pour ce partage :)
Quoique ? j'ai parlé trop vite ...
En bref, ça crée une sphère qui grandit progressivement en repoussant les objets alentours
je ne vois pas cette sphère grandir.

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 18:32
par comtois
kelebrindae a écrit :J'ai mis longtemps à trouver, mais tu vas rire: c'est le paramètre "PickMask" de "CreateEntity" qui provoque la disparition des ombres. 8O

En effet, si je remplace:

Code : Tout sélectionner

  box = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtRed), (dimX/2 - Random(dimX))*0.9, barrierHeight+Random(10), (dimY/2 - Random(dimY))*0.9,0)
par:

Code : Tout sélectionner

  box = CreateEntity(#PB_Any,MeshID(cubeMesh),MaterialID(mtRed), (dimX/2 - Random(dimX))*0.9, barrierHeight+Random(10), (dimY/2 - Random(dimY))*0.9)
(J'ai juste enlevé le PickMask), les ombres refont leur apparition.
Etonnant, non?

Plus étonnant encore: le PickMask affecte le BlendingMode des materials.
Sur l'entity "barrier2" (celle du premier plan), si je mets un PickMask différent de zéro, ou si je supprime ce paramètre, on ne voit plus les objets au travers de la même façon qu'avant. :|
Bizarre, bizarre...
Vous avez dit bizarre ? Comme c'est bizarre.

Reste plus qu'à chercher sur le forum d'ogre s'il existe des parades à ce problème !! Parce que du côté de PB il n'y a rien de particulier. Je ferai quand même une vérif, mais c'est peu probable que le problème soit de ce côté.

En tous cas merci pour le temps que tu auras passé pour trouver ce truc vraiment bizarre !

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 20:20
par G-Rom
Sans passé par une sphère , tu peu appliqué une impulsion suivant la distance :

Code : Tout sélectionner



InitEngine3D(1) : InitSprite()


wnd = OpenWindow(#PB_Any,0,0,1024,768,"")
OpenWindowedScreen(WindowID(wnd),0,0,1024,768)



camera = CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(camera,180,180,180)
CameraLookAt(camera,0,0,0)
CameraFOV(camera,30)

light = CreateLight(#PB_Any,$AADFE2,-1000,1000,1000)
AmbientColor($505050)
WorldShadows(#PB_Shadow_Modulative)



green_texture = CreateTexture(#PB_Any,128,128)

StartDrawing(TextureOutput(green_texture))
  Box(0,0,128,128,$00FF00)
  Box(0,0,64,64,$00AA00)
  Box(64,64,64,64,$00AA00)
StopDrawing()

Global green_material = CreateMaterial(#PB_Any,TextureID(green_texture))

gray_texture = CreateTexture(#PB_Any,128,128)

StartDrawing(TextureOutput(gray_texture))
  Box(0,0,128,128,$DADADA)
StopDrawing()

gray_material = CreateMaterial(#PB_Any,TextureID(gray_texture))


plane_mesh   = CreatePlane(#PB_Any,1000,1000,1,1,100,100)
plane_entity = CreateEntity(#PB_Any,MeshID(plane_mesh),MaterialID(green_material))
EntityPhysicBody(plane_entity,#PB_Entity_StaticBody,0,0.2,0.8)

box_mesh     = CreateCube(#PB_Any,1)

corner_1   = CreateEntity(#PB_Any,MeshID(box_mesh),MaterialID(gray_material),0,5,-50)
ResizeEntity(corner_1,100,20,10)
EntityPhysicBody(corner_1,#PB_Entity_StaticBody,0,0.2,0.8)

corner_2   = CreateEntity(#PB_Any,MeshID(box_mesh),MaterialID(gray_material),0,5,50)
ResizeEntity(corner_2,100,20,10)
EntityPhysicBody(corner_2,#PB_Entity_StaticBody,0,0.2,0.8)

corner_3   = CreateEntity(#PB_Any,MeshID(box_mesh),MaterialID(gray_material),-50,5,0)
ResizeEntity(corner_3,10,20,110)
EntityPhysicBody(corner_3,#PB_Entity_StaticBody,0,0.2,0.8)

corner_4   = CreateEntity(#PB_Any,MeshID(box_mesh),MaterialID(gray_material),50,5,0)
ResizeEntity(corner_4,10,20,110)
EntityPhysicBody(corner_4,#PB_Entity_StaticBody,0,0.2,0.8)



Structure physic_object
  pID.i
  pX.f
  pY.f
  pZ.f
EndStructure

Global NewList physObject.physic_object()

Global boxMesh = CreateCube(#PB_Any,5)

Global explodeX.f     = 0
Global explodeY.f     = 25
Global explodeZ.f     = 0
Global explodeForce.f = 55.0
Global explodeTimer.i = ElapsedMilliseconds() + 2500

Procedure createBox(x.f,y.f,z.f,angle.f)
  AddElement(physObject())
  
  physObject()\pID = CreateEntity(#PB_Any,MeshID(boxMesh),MaterialID(green_material),x,y,z)
  RotateEntity(physObject()\pID,0,angle,0)
  EntityPhysicBody(physObject()\pID,#PB_Entity_BoxBody,0.5,0.2,0.8)

  physObject()\pX   = x
  physObject()\pY   = y
  physObject()\pZ   = z
  
EndProcedure

Procedure updateBox()
  Static timer
  
  If timer < ElapsedMilliseconds()
    timer = ElapsedMilliseconds() + 75
    
    If explodeTimer < ElapsedMilliseconds()
      ForEach physObject()
        
        physObject()\pX = EntityX(physObject()\pID)
        physObject()\pY = EntityY(physObject()\pID)
        physObject()\pZ = EntityZ(physObject()\pID)
        
        distance.f = Sqr( ((physObject()\pX - explodeX)*(physObject()\pX - explodeX)) + ((physObject()\pY - explodeY)*(physObject()\pY - explodeY)) + ((physObject()\pZ - explodeZ)*(physObject()\pZ - explodeZ)) )
        
        directionX.f = physObject()\pX - explodeX
        directionY.f = physObject()\pY - explodeY
        directionZ.f = physObject()\pZ - explodeZ
        
        length.f = Sqr(directionX*directionX + directionY*directionY + directionZ*directionZ)
        
        If length>0
          directionX / length
          directionY / length
          directionZ / length
        EndIf 
        
        
        force.f = explodeForce - distance
        
        If force < 0 
          force = 0
        EndIf 
        
        ApplyEntityImpulse(physObject()\pID, directionX * force,directionY * force, directionZ * force)
        
      Next 
      explodeTimer = ElapsedMilliseconds() + 2500
    EndIf 
    
  EndIf 
  
EndProcedure


For i = 1 To 36
  x.f = 0 + 40 * Cos((i*10)*#PI/180)
  y.f = 0 + 40 * Sin((i*10)*#PI/180)
  
  For j = 0 To 9
    createBox(x,5+(j*5),y,-(i*10))
  Next 
Next 



For i = 0 To 9
    createBox(60,5+(i*5),60,0)
    createBox(-60,5+(i*5),60,0)
    createBox(-60,5+(i*5),-60,0)
    createBox(60,5+(i*5),-60,0)
Next 



Repeat
  event = WindowEvent()
  
  updateBox()
  
  ClearScreen(0)
  
  RenderWorld(100)
  FlipBuffers()
Until event = #PB_Event_CloseWindow
Avec une force négative c'est sympa aussi ;)

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 20:31
par comtois
Sympa cet exemple G-Rom tu reviens en forme :)

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 22:46
par G-Rom
oui , dsl de ne pas avoir donner + de news, j'ai eu qq soucis ces derniers temps , je devrais être un peu plus présent maintenant.

Re: [PB 5.10b2] - Explosions + Physique

Publié : mar. 15/janv./2013 23:46
par G-Rom
un autre exemple avec des corps qui s'attire entre eux.

Code : Tout sélectionner



InitEngine3D(1) : InitSprite()


wnd = OpenWindow(#PB_Any,0,0,1024,768,"")
OpenWindowedScreen(WindowID(wnd),0,0,1024,768)


camera = CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(camera,8000,8000,8000)
CameraLookAt(camera,0,0,0)
CameraFOV(camera,35)

light = CreateLight(#PB_Any,$AADFE2,-1000,1000,1000)
WorldGravity(0)


green_texture = CreateTexture(#PB_Any,128,128)

StartDrawing(TextureOutput(green_texture))
  Box(0,0,128,128,$00FF00)
  Box(0,0,64,64,$00AA00)
  Box(64,64,64,64,$00AA00)
StopDrawing()

Global green_material = CreateMaterial(#PB_Any,TextureID(green_texture))



Structure physic_object
  meshID.i
  pID.i
  pX.f
  pY.f
  pZ.f
  radius.f
EndStructure

Global NewList physObject.physic_object()


Procedure CreatePlanet(x.f,y.f,z.f,radius.f)
  AddElement(physObject())
  
  physObject()\meshID = CreateSphere(#PB_Any,radius) 
  physObject()\pID    = CreateEntity(#PB_Any,MeshID(physObject()\meshID),MaterialID(green_material),x,y,z)
  RotateEntity(physObject()\pID,0,angle,0)
  EntityPhysicBody(physObject()\pID,#PB_Entity_BoxBody,0.5,0.2,0.8)

  physObject()\pX       = x
  physObject()\pY       = y
  physObject()\pZ       = z
  physObject()\radius   = radius
EndProcedure

Procedure updatePlanet()
  
 
  Static timer
  
  If timer<ElapsedMilliseconds()
    timer = ElapsedMilliseconds() + 75
    ForEach physObject()
      
  PushListPosition(physObject())
    *other.physic_object = @physObject()
    ForEach physObject()
      If *other <> @physObject()

        physObject()\pX = EntityX(physObject()\pID) 
        physObject()\pY = EntityY(physObject()\pID)
        physObject()\pZ = EntityZ(physObject()\pID)
        
        *other\pX = EntityX(*other\pID) 
        *other\pY = EntityY(*other\pID)
        *other\pZ = EntityZ(*other\pID)

        distance.f = Sqr( ((physObject()\pX - *other\pX)*(physObject()\pX - *other\pX)) + ((physObject()\pY - *other\pY)*(physObject()\pY - *other\pY)) + ((physObject()\pZ - *other\pZ)*(physObject()\pZ - *other\pZ)) )

        directionX.f = physObject()\pX - *other\pX
        directionY.f = physObject()\pY - *other\pY
        directionZ.f = physObject()\pZ - *other\pZ
                       
        
        length.f = Sqr(directionX*directionX + directionY*directionY + directionZ*directionZ)
        
        If length>0
          directionX / length
          directionY / length
          directionZ / length
        EndIf 
        
        force.f    =  (physObject()\radius*10) - (distance - (physObject()\radius*10)) 

        If force < 0
          force = 0
        EndIf 
        
        If force > 1
          force = 1
        EndIf 

         ApplyEntityForce(*other\pID, directionX * force,directionY * force, directionZ * force)
 
      EndIf
    Next 
  PopListPosition(physObject())
Next
EndIf 

EndProcedure

For i = 0 To 399
  CreatePlanet(Random(5000),Random(5000),Random(5000),20+Random(50))
Next 


Repeat
  event = WindowEvent()
  
 
  
  ClearScreen(0)
  updatePlanet()
  RenderWorld(100)
  FlipBuffers()
Until event = #PB_Event_CloseWindow

Re: [PB 5.10b2] - Explosions + Physique

Publié : mer. 16/janv./2013 19:36
par graph100
C'est génial comme exemple G-Rom !!

Par contre, la 1ère fois je l'ai lancé avec le débugger... quelle erreur !

(pour le continuer : en fonction de la distance entre deux sphères et si elles se touchent avec une certaine force, les agréger pour faire des planètes :)
Mais est-il possible de pouvoir récupérer la force de collision entre 2 entités ? ou alors au moins leur vitesse avant choc ?

Re: [PB 5.10b2] - Explosions + Physique

Publié : mer. 16/janv./2013 21:05
par G-Rom
oui , c'est possible , tu analyses la position à des intervalles de temps régulier , à chaque intervalle du calcul le delta des positions , cela te donnera
un vecteur direction non normalisé (-1 à 1).

oldposition - newposition

plus la valeur est forte , plus la vitesse est élevée , évidement , tu ne normalise pas le vecteur pour avoir un résultat cohérent , si tu le normalise tu aura la direction de l'objet à l'instant T.

@++

Re: [PB 5.10b2] - Explosions + Physique

Publié : jeu. 17/janv./2013 0:08
par graph100
Effectivement il n'est pas question de les normaliser, sinon on perd la valeur de vitesse :lol:

Par contre, comme le moteur physique gère apparemment les collisions et le rebond, je me demandais si il est possible de récupérer la valeur interne qu'il utilise lors des collisions pour, par exemple, calculer l'énergie de collision, et en partant de là, créer des progs qui gère des dégâts sur entity... dégâts faits par le programmateur bien sur :mrgreen:
Mais avoir cette valeur rendrait cette tache plus aisée !
Le problème est que je ne connais absolument pas le fonctionnement interne du module 3D, et je ne sais pas si je demande la lune ou pas !