Navigation

    CreatiCode Scratch

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

    Limit Physics Body Rotation Speed and Direction

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

      Description

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

      c5c759d2-8d6e-4b79-856b-7b136abdc458-image.png

       

      Let’s go through the 5 input parameters:

       
       

      Speed Limit

      The first input is the maximum speed the object is allowed to rotate in:

      • If the object is rotating at a slower speed, then it will not be affected by this limit;
      • If the object is rotating 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 rotate too fast.

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

       
       

      Allowed Rotation Axes

      The next 3 inputs are used to specify whether the object is allowed to rotate around each of the 3 axes. For example, if we set X to “No”, then the object will not rotate around the X axis.

       
       

      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.

      405818e6-f558-463e-81ad-89cd88604dc8-image.png

       

      When there is no limit, the box will rotate around both the X-axis and Y-axis.

      If we set a rotation speed limit of 10, the box will rotate much slower.

      If we set the X direction to “No”, then the box would only rotate around the Y-axis.

      If we set the Y direction to “No” as well, then the box would not rotate at all.

       

      You can play with this project here:

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

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