Navigation

    CreatiCode Scratch Forum

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

    Add Trails to Meshes

    3D Blocks
    1
    1
    237
    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

      • Adding Boxes
      • Names and Sprite Objects

       

      Introduction

      Sometimes we have objects that move really fast, such as a ball or a bullet. We can add trails to such objects to show their moving paths.

      Note that the trail is thicker at its head, and it gradually shrinks in width until it disappears at its tail.

       

      The “Add Trail” Block

      The “add trail” block adds a new trail to the current sprite object selected for the current sprite. Let’s refer to that object as the “target object”.

       

       

      Diffusion and Emission Colors

      You can set these 2 colors to the trail mesh, just like how you update the color of a box. Note that often we want to make the tail glow some lights, so the emission color will be used to set the color of the glow.

       

      Width

      This value controls the width of the trail at its head (the thickest point). Note that the trail will be drawn with the same width at its head no matter from which angle our camera is looking at it.

       

      Segments

      This value controls the length of the trail indirectly. Each segment corresponds to one of the previous positions of the target object. If the Segments value is 50, then the trail will be drawn along a path that connects all the past 50 segments. So when the target object is moving faster, the distance between the segments will be longer.

       

      Demo

      In this demo, a sphere moves left and right repeatedly, and a trail is added to show its path.

      In the program, there are 2 places worth mentioning.

      1. To make the trail glow colors, we need to add the trail itself to the glow layer, not the target object for the trail.
      2. After adding the trail, it becomes the sprite object itself. So to make the original target object “s” to move left and right, we need to select that object first.

      e4ad241a-099b-4336-9502-466a117e661c-image.png

       
      Try it yourself here:

      https://play.creaticode.com/projects/63e4e69aef66187247332746

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