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. 3D Blocks
  4. Limit Physics Body Movement Speed and Direction

Limit Physics Body Movement Speed and Direction

Scheduled Pinned Locked Moved 3D Blocks
1 Posts 1 Posters 856 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

    Description

    When an object is controlled by the physics engine, you can set limits on how it moves using this block:

    5e3066e1-d87a-406e-84be-b1fb8c2d889e-image.png

     

    Let’s go through the 5 input parameters:

     
     

    Speed Limit

    The first input is the maximum speed the object is allowed to move:

    • If the object is moving at a slower speed, then it will not be affected by this limit;
    • If the object is moving at a faster speed, then its speed will be reduced to this value.

    In other words, you can use this block to make sure an object does not move too fast. When an object moves too fast, it might jump to the other side of an obstacle, so the physics engine will not correctly treat it as being blocked by the obstacle.

    If you do not want to set a speed limit, you can leave this input empty or specify a very large number.

     
     

    Allowed Directions

    The next 3 inputs are used to specify whether the object is allowed to move in each of the 3 directions. For example, if we set X to “No”, then the object’s movement along the X axis will always be 0. As a result, it will always stay at the same X position.

     
     

    Object Name

    If you leave the name input empty, the currently selected sprite object will be given the speed limit. If you input an object’s name, then that object will be given the speed limit.

     
     

    Demo

    In this program, we place a box on a plane, then apply an impulse to push it.

    9d5b5577-2351-4bf5-ba26-2c1af087b346-image.png

     

    When there is no limit, the box flies to the right forward direction.

    If we set a speed limit of 111 or 11, the box is much slower.

    If we set the X direction to “No”, then the box would only move along the Z-axis and Y-axis.

    If all 3 directions are not allowed, then the box will stay where it is.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/87857adc-7ef6-408e-85bd-2e015affed6d.gif" width="1300" style="border-radius: 5px; border: 1px solid #29622d;">

     

    You can play with this project yourself here:

    https://play.creaticode.com/projects/d41dbd54ff5e9cbed1f59c61

    1 Reply Last reply
    0

    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