Navigation

    CreatiCode Scratch Forum

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

    Iterate through all 3D objects

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

      Introduction

      When there are many objects in a 3D scene, you can iterate through all of them using the following block:

      ace349ad-1982-4da7-b3cc-db38788da9f8-image.png

       
      This block will go through all 3D objects created in the current sprite one by one. The variable dropdown allows you to specify a variable, so that the name of each object is stored in this variable one by one.

      You can use this variable to select that object inside this loop, and then add other blocks to manipulate that object.

       
       

      Example Program

       
      This program will create 3 boxes and move them one by one repeatedly. Note that to move a box, we need to select it as the “sprite object” first, and the “object name” variable tells us the name of each box.

       

      53d80d5c-b1df-4e8c-b203-97b1acb1c949-image.png

       
      This is the result:

      obj.gif

       
      You can try the program here:

      https://play.creaticode.com/projects/3b5253351ee5292751648924

      1 Reply Last reply Reply Quote 0
      • First post
        Last post