Navigation

    CreatiCode Scratch Forum

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

    Car with Physics Simulation: Control Individual Wheels

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

      In an earlier article, you learned how to steer or drive a car with physics simulation.

      Sometimes you may need to control the 4 wheels individually. For example, you might want to turn them to different directions. You’ll learn how to do that in this article.

       
       

      Set Wheel Directions Individually

      You can use the following block to set the direction of each wheel:

      6921722c-5019-481c-a641-70391e02182b-image.png

       
      The first 4 inputs are the direction values for each of the 4 wheels: LF (left front), RF (right front), LB (left back) and RB (right back). Usually, you should put in direction values between -90 and 90 degrees.

      The last input is the name of the physics-based car. You can leave this input blank if the car is already the selected sprite object.

      For example, the following block will turn the 4 wheels to 45 degrees and -45 degrees, so that they form a circle path:

      7470cba6-0cd5-43bd-8651-5c67d28728c2-image.png

       
      The wheels will look like this:

       
       

      Set Engine Force for Each Wheel Individually

      You can use the following block to set the engine force for each wheel:

      400b5955-25fa-4c35-8164-18d46268ef58-image.png

       
      The first 4 inputs are the engine forces applied to each of the 4 wheels: LF (left front), RF (right front), LB (left back) and RB (right back). If it is positive, that wheel will roll forward; if it is negative, then that wheel will roll backward.

      The brake level is set for the entire car, which is the percentage the speed will reduce each time this block runs.

      The last input is the name of the physics-based car. You can leave this input blank if the car is already the selected sprite object.

      For example, this block will drive the 2 left wheels forward and the 2 right wheels backward:

      5c9b1e3d-9177-4e4c-8956-d364a82ef2a2-image.png

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