locked
Is this possible? RRS feed

  • Question

  • hi! i always wondered if the following is possible, because it would be very useful!

    when you look at my steam code: BPV315 you'll see that the steam only being accelerated thowards the top. but i want it to be accelerated to every direction (360 degrees)

    so i would get something like this:

    i can set the angle of the emitter. for example 45° and then the steam is being accelerated in that direction.

    but i dont know if this is possible with the way i coded it. is it just possible if i use that formula wich moves objects by its angle??
    Live for nothing, OR CODE FOR SOMETHING!
    Sunday, November 15, 2009 2:07 PM

Answers

  • Just like all the other movement, the velocity is a vector that can be changed (accelerated) in any direction.  when you do friction with this it is best to multiply the velocity by some number less than 1, rather than add something to it.  Also, treat the X and Y directions of the velocity similarly, there is no special direction if you don't include gravity.

    Here is your code slightly modified (import BPV315-0) - use the right button to rotate the emitter.
    • Marked as answer by Dudeson Sunday, November 15, 2009 7:40 PM
    Sunday, November 15, 2009 7:00 PM

All replies

  • Just like all the other movement, the velocity is a vector that can be changed (accelerated) in any direction.  when you do friction with this it is best to multiply the velocity by some number less than 1, rather than add something to it.  Also, treat the X and Y directions of the velocity similarly, there is no special direction if you don't include gravity.

    Here is your code slightly modified (import BPV315-0) - use the right button to rotate the emitter.
    • Marked as answer by Dudeson Sunday, November 15, 2009 7:40 PM
    Sunday, November 15, 2009 7:00 PM
  • now that was ____ cool! extremely awesome!

    you just modified the emitter right? (and also commented the gravity and the rotation out.)

    and is there a way to still have the rotation of the smoke?
    Live for nothing, OR CODE FOR SOMETHING!
    Sunday, November 15, 2009 7:40 PM
  • Yes, I just set the initial emitter velocity dependent on direction, replaced the "air resistance" with friction by multiplying both X and Y velocities by 0.95. 

    The only reason I commented out the rotation was that it was scaled by the X velocity, which didn't look so good to me with the rotating emitter - but this was just cosmetic - of course you can put it back in.

    Sunday, November 15, 2009 7:49 PM
  • oh! didnt even notice that! thats a good solution^^


    i know. youre right. but i didnt mean "is it possible to still have it on" i meant is there a good solution to still have rotation, wich will make it prettier. but it cant be done by just the x velocity anymore..
    hmm.. maybe with WX*WY...
    Live for nothing, OR CODE FOR SOMETHING!
    Sunday, November 15, 2009 7:52 PM
  • Oh, aesthetically I'm not sure what looks good - there is no right answer - try stuff out - here's an idea, but I'm not convinced it helps:

    I tried setting a new variable in SteamEmitter sub

    Steam_Rotation[Steam_New] = Math.GetRandomNumber(9)-5


    and in the SteamCode sub

    Steam_Angle[s] = Steam_Angle[s] + Steam_Rotation[s]

    Also deleting it as as the others when the sprite is deleted.

    Steam_Rotation[s] = ""
    Sunday, November 15, 2009 8:15 PM
  • i improved your idea above.

    here it is:

    DCC658

    this version also has collision. but too bad i dont know how to make the smoke really collide (emergent angle = incidence angle, or how you call it in english...)
    Live for nothing, OR CODE FOR SOMETHING!
    Monday, November 16, 2009 8:12 PM
  • can you give me the formula for reflections on circles? plz! that would be so awesome! i just managed to change the steam emitting formula a little. but it acts more like its reflecting from a cube than a circle...
    Live for nothing, OR CODE FOR SOMETHING!
    Thursday, November 19, 2009 7:09 PM
  • The angle of reflection is equal to the angle of incidence.  You need to calculate:

    1] the angle the particle takes towards the circle (theta)
    2] the contact point on the circle - this defines the 'normal' angle (phi) - the point of contact is a tangent to the circle and the 'normal' is the radius direction
    3] use the angle of incidence (theta-phi) is equal to the reflection angle (phi-psi)
    4] the particle bounces with angle psi

    The geometry can be a bit involved and the easiest way will depend on what variables you know and what you have to calculate, but the idea of angle of incidence = angle or reflection is quite straight forward.

    Here is a short example, not very pretty, but reasonably commented, import NGT295.
    Thursday, November 19, 2009 9:26 PM
  • thx!

    sry, but how can i actually implement this to make the steam particles bounce off?

    import code: DRK833

    ....


    Live for nothing, OR CODE FOR SOMETHING!
    Thursday, December 3, 2009 11:11 PM
  • Try import VTW600 (changes commented in the code).

    Sunday, December 6, 2009 5:11 PM