Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Moving and Rotating Particles

    3D Blocks
    1
    1
    303
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • info-creaticode
      CreatiCode last edited by admin

      Prerequisite

      Single-Point Particle Emitter

       

      Introduction

      Suppose you already know how to create a single-point particle emitter, you can also make the particles move and rotate, which will create more interesting patterns.

       
       

      Movement Speed and Direction

      You can set the moving speed and direction of the particles using the following block:

      d8b14f75-9ca8-463f-a8f8-e25960ffcdac-image.png

       

      The first parameter is the name of the emitter you want to update, which can be left empty if the emitter is the currently selected sprite object.

      The next 2 parameters set the minimum and maximum speed of the particles. For each particle, it will pick a random speed within this range. By default, the speed is 0 for all particles.

      The next 6 parameters allow us to set 2 directions. For each direction, you can specify 3 numbers as X/Y/Z positions. You can think of it as an arrow shooting from the origin of the world to a point at the given X/Y/Z positions. For example, if you want the particle to move up along the Z axis, you can set x to 0, y to 0 and z as 1. If you want the particle to move to the right, you can set x to 1, y to 0 and z to 0.

      If direction 1 and direction 2 are different, then each particle will pick a random direction in-between these 2 directions.

       
       

      Example 1 - Rising Particles

      In this program, we set the min and max speeds to 100, so every particle is at the same speed. Direction 1 and direction 2 are the same. They are both pointing upwards. The capacity and emitting rate are both 5, so we see 5 circles going up continuously.

      5618823f-e9c8-49df-9906-80a661d67d7f-image.png

       

      t1.gif

       
       

      Example 2 - Different Speeds

      Suppose we change the minimum speed to 10, then the 5 particles may have a random speed between 10 and 100.

      9688a19a-4012-4a08-bfe3-981de7b1432c-image.png

       
      We see some moving faster and some slower, so the faster ones may rise through the slower ones:

      t2.gif

       
       

      Example 3 - Different Directions

      In this example, we increase the capacity to 30, set speed to 100 for all particles, then change direction 2 to point to the right.

      15773406-64c7-4611-90bd-a14e6b0015d4-image.png

       
      As a result, the particles will randomly move in the up right direction:

      t3.gif

       
       

      Rotation Speed

      We can also make each particle rotate around its own center. Recall that each particle is just a 2D image, so it can rotate just like how any image rotates around itself. This block is used to set the rotation speed:

      afb9273f-ab18-4ed1-9183-88b475d339d7-image.png

       

      The first parameter is the name of the emitter you want to update, which can be left empty if the emitter is the currently selected sprite object.

      The next 2 parameters set the minimum and maximum rotation speed of the particles at the very beginning. The number is given in degrees, so a value of 360 means the particle image would make a full rotation each second. For each particle, its rotation speed will be randomly picked between these 2 numbers.

      After that, you can also specify the ending rotation speed. You can make the particles rotate faster toward the end by setting some larger values for the ending rotation speed.

      Lastly, you can specify the rotation speed at an intermedia point. For example, if the “progress point” is 50%, then the particle’s rotation speed will be set to a random value between the last 2 inputs when it is exactly halfway through its lifetime.

       
       

      Example 4 - Rotating at Fixed Speed

      In this example, we have only one particle in the system, which grows from size 1 to size 100 by default. We set its rotation speed to be fixed at 360 degrees per second.

      750aaebc-d6b1-4645-8351-e966a55cbb2c-image.png

       
      t4.gif

       
       

      Example 5 - Rotating at Increasing Speed

      In this example, we set the starting rotation speed to 0, and ending speed to 720 degrees per second. For the 10 particles, we can see that they do not rotate much when the are just created, then they start to rotate faster and faster as they grow bigger.

      360121e6-98e5-42ba-954f-56acda6bff66-image.png

       
      t6.gif

       
       

      Example 6 - Rotating and Moving

      In this example, we make the particles rise up and rotate and the same time. The rotation speed also increases over time. They form a “tornado” pattern.

      4060f06f-940f-4449-bb72-edffbf400009-image.png

       
      t7.gif

      1 Reply Last reply Reply Quote 0
      • Pinned by  info-creaticode info-creaticode 
      • First post
        Last post