Particle emitter speed

Advanced game related topics
Violet
Enthusiast
Enthusiast
Posts: 106
Joined: Sun Dec 23, 2007 6:30 pm

Particle emitter speed

Post by Violet »

Am I blind or is it really that way, that you are not abled to influence the speed of the particles of a particle emitter? :|
Changing the velocity does not seem to affect the particles, there is not difference between a velocity of 50 and 0.00000001.

PureBasic 4.60 Beta 3 on Windows 7 32-Bit.
best regards,

Violet
User avatar
Demivec
Addict
Addict
Posts: 4270
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Particle emitter speed

Post by Demivec »

Violet wrote:Am I blind or is it really that way, that you are not abled to influence the speed of the particles of a particle emitter? :|
Changing the velocity does not seem to affect the particles, there is not difference between a velocity of 50 and 0.00000001.
Do you have some code that demonstrates what you are talking about?
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Particle emitter speed

Post by Comtois »

i can see a difference in the particle.pb example (just added ParticleVelocity() to test)

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Particle
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;

#CameraSpeed = 10

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D()
  
  Add3DArchive("Data", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    LoadTexture(0, "flare.png")
    
    CreateMaterial(0, TextureID(0))
    DisableMaterialLighting(0, 1)
    MaterialBlendingMode   (0, #PB_Material_Add)
    
    CreateParticleEmitter(0, 10, 1, 1, 0)
    ParticleMaterial    (0, MaterialID(0))
    ParticleTimeToLive  (0, 2, 2)
    ParticleEmissionRate(0, 20)
    ParticleSize        (0, 30, 30)
    ParticleColorRange  (0, RGB(255,0,0), RGB(255,0,255))
    ParticleVelocity(0,  0, 1)
    
    
    CreateParticleEmitter(1, 10, 1, 1, 0)
    ParticleMaterial    (1, MaterialID(0))
    ParticleTimeToLive  (1, 2, 2)
    ParticleEmissionRate(1, 20)
    ParticleSize        (1, 30, 30)
    ParticleColorRange  (1, RGB(255,255,0), RGB(0,255,0))
    ParticleVelocity(1,  50, 100)
    
    MoveParticleEmitter(1, -50, 0, 0)
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,100)
    
    Repeat
      Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
      
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf
        
      EndIf
      
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
      
      RotateCamera(0, MouseY, MouseX, RollZ, 16|64)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      RenderWorld()
      Screen3DStats()
      
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End
Please correct my english
http://purebasic.developpez.com/
Violet
Enthusiast
Enthusiast
Posts: 106
Joined: Sun Dec 23, 2007 6:30 pm

Re: Particle emitter speed

Post by Violet »

That's it (example above). Independent from the set velocity the particles seem to move still with the same speed. And some other thing that irritated me is that in the documentation particle speed and velocity were meant as two different properties of a particle emitter in the description of the library. But there is only the command for particle velocity.
best regards,

Violet
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: Particle emitter speed

Post by [blendman] »

Hi, for the speed of the particles, you can change the direction of the particle and it works.

Try a direction of 0.1 or 0.2 for exemple, in the direction that you want.

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Particle
;
;    (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;

#CameraSpeed = 10

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D()

  Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    LoadTexture(0, "flare.png")
    
    CreateMaterial(0, TextureID(0))
      DisableMaterialLighting(0, 1)
      MaterialBlendingMode   (0, #PB_Material_Add)
        
    CreateParticleEmitter(0, 10, 1, 1, 0)
      ParticleMaterial    (0, MaterialID(0))
      ParticleTimeToLive  (0, 0, 5)
      ParticleEmissionRate(0, 20)
      ParticleSize        (0, 30, 30)
      ParticleColorRange  (0, RGB(255,125,125), RGB(255,125,255))
      ParticleEmitterDirection(0,0,0.03,0)


    CreateParticleEmitter(1, 10, 1, 1, 0)
      ParticleMaterial    (1, MaterialID(0))
      ParticleTimeToLive  (1, 0, 4)
      ParticleEmissionRate(1, 20)
      ParticleSize        (1, 30, 30)
      ParticleColorRange  (1, RGB(255,255,0), RGB(0,255,0))
      ParticleVelocity(1,  0, 10)
      ParticleColorFader(1,1,1,1)
      ParticleEmitterDirection(1,0,0.08,0)

    MoveParticleEmitter(1, -50, 0, 0)
  
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,100)
          
    Repeat
      Screen3DEvents()
            
      If ExamineKeyboard()
        
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
                  
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf

      EndIf
      
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
      
      RotateCamera(0, MouseY, MouseX, RollZ, #PB_Relative)
      MoveCamera  (0, KeyX, 0, KeyY)
    
      RenderWorld()
      Screen3DStats()

      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
    
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
  
End
Zach
Addict
Addict
Posts: 1676
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Particle emitter speed

Post by Zach »

Violet, FYI Purebasic 4.60 Final was released a couple days ago. I noticed you posted you were still using Beta 3 :!:
Post Reply