Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. Tutorials
  4. 3D - Pick A Letter (Difficulty: 2)

3D - Pick A Letter (Difficulty: 2)

Scheduled Pinned Locked Moved Tutorials
1 Posts 1 Posters 1.7k Views
  • 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.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

     

    Introduction

    In this tutorial, we’ll build a simple picking program that shows 3 letters of “A”, “B” and “C”, and show different animations depending on which letter is picked.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/06211974-8325-4ab9-80d5-101b43ad42b4.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 1 - An “Empty” Scene with 3D Axes

    Please create a new project, remove the dog sprite, and add these blocks in the “Empty1” sprite. You can find the “initialize 3D scene” and the “show 3D axis” blocks in the “3D Scene” category.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/43a6f24e-b195-4762-a219-822a46559d96.png" width="400" style="filter: drop-shadow(0.35rem 0.35rem 0.4rem rgba(0, 0, 0, 0.5));">
     
    As shown, the X-axis points to the right, the Y-axis points forward (into the screen), and the Z-axis points up. You can drag your mouse on the stage to rotate the camera around it:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dcebc38b-cc87-4eb8-a3f1-6252211315eb.gif" width="460" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 2 - Add the Letter “A” Costume

    Next, switch to the “Costumes” tab, and click the button at the bottom left to open the costume library. Find and select the costume for the letter “A” named “Glow-A”.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ac64be39-44d5-4724-9194-bff8c1dc56f8.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 3 - Extrude “Glow-A” to a 3D Letter

    Now we need to add the letter to our 3D world. A costume image is 2-dimensional, so it has no thickness. To give it some thickness, we will use the “extrude” block in the “3D Object” category.

    You will need to select the “Glow-A” costume, set a white side color, and name this new object “A”.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/266b9512-b354-4fd7-91fa-a60b9eddb9ee.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 4 - Make the Letter Object Spin

    For some fun, let’s make the letter spin around. You can set its “Z-Rotation” speed to make it rotate around the Z-axis. Try different speed values, like 200.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/29b038c1-ce93-4211-b0a8-19b0abaa79ce.png" width="600" style="">
     
    You should now have a spinning letter A like this:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d98c0832-e9b3-4608-9a21-57a3db667dfc.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 5 - Add “Glow-B” Costume and Extrude It

    Next, we need to add the “Glow-B” costume.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/25d3d748-7bc1-43fa-9602-348ce2794594.png" width="600" style="border-radius: 5px; border: 1px solid #29622d;">

     
    After that, duplicate the code to extrude and spin this new letter object. Don’t forget to name it “B”. If you reuse the name “A”, then the first letter object named “A” will be removed.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/05c2d47c-c2a0-448f-bea8-5e141323c508.png" width="600" style="">

     
    Now we have 2 letter objects spinning together:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f12fe184-f9b7-4628-8b22-9b69f299a4ba.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 6 - Move Letter “B” to the Left

    To separate the 2 letter objects, we can move the “B” object to the left. Since the X axis is pointing to the right, we can set “B” to a negative X position.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/8f2d6711-f78e-4601-87c0-7314a8459c8b.png" width="600" style="">

    Note that the “A” object will not be moved, since object “B” is the one that’s most recently added before the “set x” block, it will only be applied to object “B”. In this case, object “B” is the active “sprite object”, and all operations are applied to object “B” until another object is selected as the new sprite object.

    This is what you should get:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/93658f84-1490-4b1f-95fe-fb38fd267be9.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 7 - Add Letter “C” to the Right

    The steps for adding the letter “C” is very similar. You can reuse most of the blocks.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/26f5fe26-7b7e-4822-be7e-af7ab6962cb4.png" width="600" style="">

    And now there are 3 letter objects:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2978c8e7-5e7e-4093-9ed9-04288186c804.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 8 - Turn on Object Picking

    Next, we will allow the user to pick any of these 3 objects using the mouse pointer. To do that, we use the “turn on picking” block. We can keep the input box blank, so all objects in the current sprite will become pickable.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/cce088df-f647-487b-b3d1-b1a2056edf5f.png" width="600" style="">

     
     

    Step 9 - Handle the picking event

    To take some action whenever an object is picked, we need to use the hat block “when an object from this sprite is picked”.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/bea84df0-809e-4834-810f-d291a6e73ed1.png" width="350" style="">

     
    After you add this hat block, when an object is indeed picked, the reporter block “picked object name” will tell us the name of that object. If no object is picked, that block will report an empty value. You can verify it by showing that block’s value:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/71681878-09ee-486e-8a6b-af4286f2e795.gif" width="1000" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 10 - Select the Picked Object

    Suppose we want to make the picked object jump up. Before that, it is critical that we select the picked object as the sprite object. Otherwise, our action blocks may not be applied to the correct object.

    You can select that object using its name, which is given by the “picked object name” block. Note that in the object list below the stage, the sprite object name is now changing as you click different objects:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/111a5c6d-4a51-4ef3-ae9a-38f44c091e5c.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 11 - Make Letter “B” Jump

    Suppose we want the letter “B” to jump when it is picked. We can check the “picked object name” to verify the picked object is indeed the letter “B”. Then we can make the letter jump up by setting its “Rising Speed”, then make it fall quickly with a large “Gravity”:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f7135c05-29d5-4fd7-acf0-7d614e8b680c.png" width="500" style="">
     
    Now only the letter “B” will jump when it is clicked:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0743772d-6dfc-4fba-a281-f6e24bdf7159.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 12 - Make Letter “A” Wiggle

    Similarly, when the letter “A” is clicked, let’s make it wiggle a bit. This can be achieved by rotating it around the “Y-axis”:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0d6c043f-ba11-473d-9b5f-ead45659b334.png" width="600" style="">
     
    The result looks like this:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2afeba53-fd30-43ae-bd65-9119aeb3803d.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Step 13 - Make Letter “C” Inflate

    Lastly, for the letter “C”, let’s make it inflate bigger and then shrink back. You can use the “update scale” block for that:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ecf3c38f-58e2-4335-92e4-f4120d83fc50.png" width="600" style="">
     
    Here is the final result:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/06211974-8325-4ab9-80d5-101b43ad42b4.gif" width="470" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    Creative Ideas

    Here are some ideas for you to further extend this project:

    • Other Objects: you can use the picking event on any type of object. It is one of the most common ways of user interaction in 3D applications.
    • Other Animation Effects: you can learn to change an object’s color/texture/glow/animation when it is picked.
    1 Reply Last reply
    0
    • CreatiCodeI CreatiCode pinned this topic on

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode