Navigation

    CreatiCode Scratch Forum

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

    Resizing an Object

    3D Blocks
    1
    1
    467
    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 to a 3D Scene
      • Loading an Avatar Into a Scene

       

      Description

      You can change the size of any object in the scene. Two methods will be introduced below.

       

      The “Update Scale” Block

      This block allows you to resize an object relative to its original size, either instantly or through an animation.

       

      Parameters

      • Scaling Percent: the ratio of the target size vs original size in each dimension. By default, 100% means the original size of the model. Note that the scaling is not relative to the current size. For example, if you scale the “X size” to 200%, then the object will double its width. But if you try to scale its X size to 200% again, nothing will change, since the object’s X size is already scaled to 200%.

      • Animation Time Period: By default the change in size happens instantly. However, if you specify a time period like 2 seconds, then the object will gradually change its scale in an animation during those 2 seconds.

      • Blocking or Not: when the animation time is more than 0 seconds, if we are in the “Blocking” mode, then blocks attached below this block will not run until the end of the animation time period. In the “Non-Blocking” mode, the blocks below will start running right away.

       

      Demo

      Here is a simple program that simulates a “heart-beat” kind of animation by repeatedly scaling the box larger then smaller:

       

      The “Update Size” Block

      If you want to update an object to a specific size directly, you can use this block.

      Note that you can leave one or two of the 3 input fields as empty. For example, if the x and y size inputs are empty, and the z size is not, then the object will be scaled so that its Z size matches with the input, and the other 2 dimensions will be scaled at the same ratio.

       

      Demo

      In this example, we have an avatar that is 100 units tall. Suppose we need to double his height to 200, we can set the target Z size to 200, and leave the X and Y inputs empty. Then the avatar will be scaled up proportionally.

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