Creating Moving Objects | Documentation - Roblox Creator Hub (2024)

Moving objects are objects that move on one or more axes within the 3D space. Using the built-in power of Roblox's simulation engine, you can make objects move and interact with their environment in a way that emulates real-world physical behavior that's familiar and intuitive to players, such as gravity, aerodynamics, and friction.

Using the Moving Objects .rbxl file as a reference, this tutorial explains how physical forces impact linear motion in Studio, and shows you various techniques to move objects from point A to point B in your experiences with different movement behavior, including guidance on:

  • Using a LinearVelocity mover constraint to move an entire assembly at a constant linear velocity.

  • Using a PrismaticConstraint to constrain an assembly to a single axis and move it at a constant linear velocity relative to a point in the 3D space.

  • Using the ApplyImpulse method to move an assembly with an initial impulse of force so that the assembly slowly decelerates over time.

You can create your own assemblies using basic parts or meshes from third-party modeling tools, then follow along with your own assets. For information on exporting meshes for use in Studio, see Exporting Requirements.

Linear Motion and Physical Forces

Roblox Studio is a real-world simulation engine that emulates physical behavior in real time, so in order to predict how objects moving linearly can behave in experiences, it's important to have a high-level understanding of how objects move in real life with linear motion.

Linear motion is movement along an axis. For example, when a block has linear motion, it moves along a set axis.

Creating Moving Objects | Documentation - Roblox Creator Hub (1)

Linear motion cannot exist without external, physical forces pushing or pulling objects to move. According to Newton's first law of motion, stationary objects remain stationary and moving objects remain in motion with a constant velocity unless they are acted on by an external force. For example, a stationary block remains stationary unless a physical force like wind pushes it to move.

Force is the measure of the direction and magnitude of a physical push or pull that causes objects to change their linear velocity along an axis. A change in velocity is known as acceleration. This concept is particularly important for objects to move in Studio; the more force you apply to objects, the more quickly they accelerate.

This is because the force needs to be greater than any physical forces pushing back against the object, such as gravity or friction. For example, if you were to place the block on a metal plate, the physical force of the wind needs to overcome the amount of friction from the metal plate to continue accelerating the block. If the wind's force is not much greater than the friction from the metal plate, the block accelerates, just more slowly than the previous example.

Creating Moving Objects | Documentation - Roblox Creator Hub (2)

Linear velocity is the measure of an object's movement, or how fast the object changes its position along an axis over a period of time. Studio measures linear velocity according to how many studs an object moves per second. Studs are Roblox's primary physical units for measuring length, and each stud equates to about 28cm in the real world.

Creating Moving Objects | Documentation - Roblox Creator Hub (3)

Understanding linear velocity is important for designing gameplay in your experiences because it helps you determine how much force you need in order to achieve a particular speed for your moving objects. For instance, when you want to propel objects upward, it's important to consider how you must adjust your force to overcome gravity within the environment so that the objects move accurately.

The following sections dive deeper into these concepts as you learn how to move objects at either a constant or initial linear velocity with the necessary force to overcome any oppositional physical forces within the environment. As you review these physics concepts with the upcoming techniques, you can more accurately predict how to adjust property values to achieve any ideal linear movement behavior in Studio.

Maintaining a Constant Linear Velocity

For an object to reach and maintain a constant linear velocity, it needs a force to overcome any oppositional physical forces that either decelerate the object's linear velocity, or cause the object to remain stationary. For example, if you want an object to have a linear velocity of [0, 12, 0] in Studio, you need enough force for the object to reach and maintain 12 studs per second along the Y axis in its environment.

The amount of force necessary not only depends on oppositional physical forces within the environment itself, such as gravity and friction, but also on the object itself. For example, if you have two objects of the same shape that are moving on the same axis, the object with the larger amount of mass requires more force to achieve the same linear acceleration.

The following subsections use assemblies of different shapes and sizes to teach you how to move either an entire object or only a portion of the object at a constant linear velocity. As you experiment with different property values, you will learn how to estimate the maximum amount of force you need for assemblies in your own experiences.

Using LinearVelocity Constraints

LinearVelocity objects are a type of mover constraint that apply force on an entire assembly to maintain a constant linear velocity. By not locking the assembly's position to an axis during its motion, the assembly is free to rotate as it collides with other objects in the 3D space. This type of movement leads to surprising gameplay scenarios that are more difficult for players to predict.


To begin moving the assembly, the LinearVelocity constraint needs to know:

  • The point and positive or negative direction to apply a force.

  • The amount of studs you want the assembly to move per second.

  • The maximum amount of force the engine can apply for the assembly to reach the constant linear velocity.

To demonstrate this process, you will configure a lily pad with an attachment that a LinearVelocity constraint references to move the lily pad 15 studs per second along the world's negative X axis at a constant linear velocity.

Creating Moving Objects | Documentation - Roblox Creator Hub (4)

Add Attachment

You can specify the point to apply force by adding an Attachment object to the assembly, then configuring the attachment's position in the 3D space. The sample Moving Objects experience places an attachment in the center of the lily pad so that the constraint can move the mesh from the attachment along a particular axis.

Attachments include visual aids to help you visualize their axes of motion. The yellow arrow denotes the attachment's primary axis, and the orange arrow denotes the attachment's secondary axis. While neither axis of motion influences the lily pad's movement in the steps of this technique, it's important to understand these visual aids for future reference because they can assist you in determining ideal behavior for different types of constraints, such as the PrismaticConstraint in the next technique.

Creating Moving Objects | Documentation - Roblox Creator Hub (5)

To add an attachment:

  1. In the Explorer window, expand the LinearVelocityExample folder, then expand its child LilyPad_DIY model.

  2. Insert an attachment into the Pad mesh.

    1. Hover over the mesh and click the ⊕ button. A contextual menu displays.

    2. From the menu, insert an Attachment. The attachment displays in the center of the part.

    3. Rename the attachment to MoveAttachment.

    Creating Moving Objects | Documentation - Roblox Creator Hub (6)

Configure Constraint

Now that your mesh has a fixed point to move the lily pad, you can configure the properties of a LinearVelocity constraint to specify the direction and magnitude for the constant linear velocity, the amount of studs you want the mesh to move per second, and the maximum amount of force the engine can apply for the mesh to reach a constant linear velocity.

The sample Moving Objects experience applies up to 5000 Rowtons of constant force to move the lily pad 15 studs per second along the world's negative X axis at a constant linear velocity. Rowtons are Roblox's primary physical units for measuring force. To reference Roblox physical units and how they convert to metric units, see Roblox Units.

To configure a LinearVelocity constraint:

  1. (Optional) Make the constraint visible in the 3D space so that you can reference its linear direction.

    1. In the menu bar, navigate to the Model tab, then the Constraints section.

    2. If it's not currently enabled, click Constraint Details to display constraint visual aids.

    Creating Moving Objects | Documentation - Roblox Creator Hub (7)
  2. Insert a LinearVelocity constraint into the Pad mesh.

    1. In the Explorer window, hover over the mesh, then click the ⊕ icon. A contextual menu displays.

    2. From the contextual menu, insert LinearVelocity.

  3. Assign the mesh's attachment to the new constraint.

    1. In the Explorer window, select the constraint.

    2. In the Properties window,

      1. Set Attachment0 to MoveAttachment.

      2. Set MaxForce to 5000 to apply up to 5000 Rowtons of constant force to achieve the target linear velocity.

      3. Keep RelativeTo to World to move the lily pad relative to the world's position and orientation.

      4. Set VelocityConstraint to Line to constrain the force along a line from the attachment.

      5. Set LineDirection to -1, 0, 0 to move the lily pad along the world's negative X axis. Note that if you were to set this property to 1, 0, 0 the lily pad would move along the world's positive X axis.

      6. Set LineVelocity to 15 to move the lily pad 15 studs per second.

    If you were to set RelativeTo to Attachment, the constraint would move the lily pad in relation to its attachment's orientation. However, as soon as the lily pad collides with objects, the attachment would rotate too and move the lily pad along a new orientation.

    Creating Moving Objects | Documentation - Roblox Creator Hub (8)
  4. Verify the amount of force you set moves the mesh 15 studs per second along the world's negative X axis.

    1. In the menu bar, navigate to the Test tab.

    2. In the Simulation section, click the Mode Picker. A dropdown menu displays.

      Creating Moving Objects | Documentation - Roblox Creator Hub (9)
    3. Select Run. Studio simulates the experience at the current camera position without your avatar in the 3D space.

Using PrismaticConstraint Constraints

PrismaticConstraint objects are a type of mechanical constraint that create a rigid joint between two attachments, allowing their parent assemblies to move along one axis relative to each other. By locking both assemblies' position to a single axis, each assembly is only able to rotate if they rotate together in the same direction.

This type of movement leads to stable gameplay scenarios that are easier for players to predict. For example, the sample Moving Objects experience uses PrismaticConstraint objects to move log platforms that players can use to carefully cross a giant river.

When you set PrismaticConstraint.ActuatorType to Motor, this constraint applies force on the two attachments with the goal of the attachments reaching and maintaining a constant linear velocity. If you anchor one of the attachments' parent assemblies, the force continues to move the unanchored assembly at a constant linear velocity while the anchored assembly remains stationary.

To begin moving the assembly, the PrismaticConstraint constraint needs to know:

  • The point and positive or negative direction to apply a force.

  • The amount of studs you want the attachments to move per second.

  • The maximum amount of force the engine can apply for the attachments and their parent assemblies to reach a constant linear velocity.

To demonstrate this process, you will configure a log assembly with two objects that have child attachments that a PrismaticConstraint references to move the log 40 studs per second along the world's negative X axis at a constant linear velocity.

Creating Moving Objects | Documentation - Roblox Creator Hub (10)

Configure Attachments

You can specify the direction to move a particular object within an assembly by adding two Attachment objects to the assembly, then configuring their alignment and orientation in the 3D space. The sample Moving Objects experience aligns two attachments along the world's X axis near the position of where the unanchored log overlaps with the anchored part, and orients each attachment's primary axis to face the world's negative X axis.

When you configure your PrismaticConstraint constraint in the next section, it will move the log in relation to the anchor part. In other words, the log will move away from the stationary part that cannot move because it's anchored in the 3D space.

To configure attachments for the prismatic constraint:

  1. In the Explorer window, expand the PrismaticConstraintExample folder, then expand its child Log_DIY model.

  2. Insert an attachment into the Log mesh.

    1. Hover over the mesh and click the ⊕ button. A contextual menu displays.

    2. From the menu, insert an Attachment. The attachment displays in the center of the part.

    3. Rename the attachment to LogAttachment.

    Creating Moving Objects | Documentation - Roblox Creator Hub (11)
  3. Using the same process, insert an attachment into the Anchor part, then rename the attachment AnchorAttachment.

    Creating Moving Objects | Documentation - Roblox Creator Hub (12)
  4. Using the View Selector tool as a reference for the world's coordinates, rotate LogAttachment and AnchorAttachment until each attachment's primary axis faces the world's negative X axis

    Creating Moving Objects | Documentation - Roblox Creator Hub (13)
  5. Reposition AnchorAttachment so that both attachments are aligned on the world's X axis.

    Creating Moving Objects | Documentation - Roblox Creator Hub (14)

Configure Constraint

Now that your attachments are aligned on the same axis and face the same direction you want the log to move, you can configure the properties of a PrismaticConstraint constraint to specify whether to apply the target constant linear velocity in the positive or negative direction of each attachment's' primary axis, the amount of studs you want the attachments to move per second, and the maximum amount of force the engine can apply for the log to reach a constant linear velocity.

While you can choose different values for your own use cases, the sample Moving Objects experience applies up to 50000 Rowtons of constant force to move the attachments 40 radians per second along the world's negative X axis at a constant linear velocity. However, because the anchor attachment is in an anchored object, only the log's attachment can move.

To configure a prismatic constraint:

  1. Insert a PrismaticConstraint object into the Log mesh.

    1. In the Explorer window, hover over the mesh, then click the ⊕ icon. A contextual menu displays.

    2. From the contextual menu, insert a PrismaticConstraint.

  2. Assign the log's attachments to the new constraint so that the log moves in relation to the anchored block part.

    1. In the Explorer window, select the constraint.

    2. In the Properties window,

      1. Set Attachment0 to AnchorAttachment.

      2. Set Attachment1 to LogAttachment. The constraint displays in the viewport.

    Creating Moving Objects | Documentation - Roblox Creator Hub (15)
  3. In the Explorer window, select the constraint, then in the Properties window,

    1. Set ActuatorType to Motor. New property fields display.

    2. Set MotorMaxForce to 50000 to apply up to 50000 Rowtons of constant force to achieve the target linear velocity.

    3. Set Velocity to 40 to move the log 40 studs per second.

    Creating Moving Objects | Documentation - Roblox Creator Hub (16)
  4. Verify the amount of force you set moves the log 40 studs per second along the world's negative X axis.

    1. In the menu bar, navigate to the Test tab.

    2. In the Simulation section, click the Mode Picker. A dropdown menu displays.

      Creating Moving Objects | Documentation - Roblox Creator Hub (17)
    3. Select Run. Studio simulates the experience at the current camera position without your avatar in the 3D space.

Applying an Initial Linear Force

Another way of changing an object's linear velocity is by applying an impulse of force. After the impulse of force, the object either decelerates until it becomes stationary if there is an oppositional force such as friction, or remains in motion with constant linear velocity if there aren't any oppositional forces.

This technique is useful to move objects after a significant gameplay event, such as an explosion or impactful collision, because it provides players instantaneous feedback. To demonstrate, the following subsection teaches you how to launch a player's character upward toward the sky when they collide with a jump pad with an initial impulse that you can adapt with new values to meet your own gameplay requirements.

Using ApplyImpulse

The ApplyImpulse method applies force on an entire assembly to obtain an initial linear velocity before slowing to a stop when there are oppositional forces. To begin moving the assembly, the method needs to know:

  • The assembly to move.

  • The axis to apply force to reach an initial linear velocity.

  • The amount of force to apply to each axis.

You can define all of these values in a script. For example, the sample script defines the assembly to move as the player character's Humanoid object, then it applies an impulse of force that's 2500 Rowton-seconds to launch the player upwards on the world's positive Y axis. Note that player characters have different amounts of mass, so you may need to increase and balance this force to launch every player without launching player characters with smaller amounts of mass too high.

To move an assembly using ApplyImpulse:

  1. In the Explorer window, expand the ApplyImpulseExample folder, then expand its child JumpPad_DIY model.

  2. Insert a script into the JumpPad part.

    1. Hover over the part and click the ⊕ button. A contextual menu displays.

    2. From the menu, insert a Script. The attachment displays in the center of the part.

    3. Rename the script to JumpScript.

  3. Replace the default code with the following code:

local volume = script.Parent

local function onTouched(other)

local impulse = Vector3.new(0, 2500, 0)

local character = other.Parent

local humanoid = character:FindFirstChildWhichIsA("Humanoid")

if humanoid and other.Name == "LeftFoot" then

other:ApplyImpulse(impulse)

end

end

volume.Touched:Connect(onTouched)

Creating Moving Objects | Documentation - Roblox Creator Hub (2024)
Top Articles
How Much Does it Cost to Resize a Ring?
Princess V42 2009 Gebruikt Boot voor Verkoop in Torquay
Express Pay Cspire
Libiyi Sawsharpener
Bashas Elearning
Faint Citrine Lost Ark
Ixl Elmoreco.com
Phone Number For Walmart Automotive Department
Steamy Afternoon With Handsome Fernando
Toyota gebraucht kaufen in tacoma_ - AutoScout24
Nesb Routing Number
Lichtsignale | Spur H0 | Sortiment | Viessmann Modelltechnik GmbH
Free Robux Without Downloading Apps
Zendaya Boob Job
Top Hat Trailer Wiring Diagram
Cvs Learnet Modules
Keniakoop
Craigslist Mpls Cars And Trucks
Foodland Weekly Ad Waxahachie Tx
Nba Rotogrinders Starting Lineups
Connect U Of M Dearborn
Alexander Funeral Home Gallatin Obituaries
Nhl Wikia
Craigslist Toy Hauler For Sale By Owner
H12 Weidian
Craigslist Southern Oregon Coast
Atdhe Net
The Weather Channel Local Weather Forecast
Craigslist Lewes Delaware
Craigslist St. Cloud Minnesota
All Obituaries | Gateway-Forest Lawn Funeral Home | Lake City FL funeral home and cremation Lake City FL funeral home and cremation
Del Amo Fashion Center Map
Target Minute Clinic Hours
Roanoke Skipthegames Com
Soul Eater Resonance Wavelength Tier List
Farm Equipment Innovations
Jamielizzz Leaked
Japanese Emoticons Stars
Mchoul Funeral Home Of Fishkill Inc. Services
Moonrise Time Tonight Near Me
How to Use Craigslist (with Pictures) - wikiHow
2024 Coachella Predictions
Xemu Vs Cxbx
Ukg Dimensions Urmc
Blackstone Launchpad Ucf
ACTUALIZACIÓN #8.1.0 DE BATTLEFIELD 2042
Citibank Branch Locations In North Carolina
Www Craigslist Com Atlanta Ga
Memberweb Bw
The Horn Of Plenty Figgerits
Pixel Gun 3D Unblocked Games
Is Chanel West Coast Pregnant Due Date
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5743

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.