-
What do you want to achieve? Keep it simple and clear!
Hi, I’d like to use motors to animate quite a few things on vehicles.
Such as car/bus doors, petrol flaps, boots (trunks) etc… however I cannot find any decent tutorials explaining how to use motors. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve searched for videos on YouTube (including Roblox’s tutorials), I’ve also read the documentation. However, I still cannot find a tutorial that doesn’t go at 100 miles per hour or isn’t explained without 100 “erms”.
Have you considered rigging your models and using animations instead of motors? What you’re wanting can certainly be achieved with motors but I’m thinking it would be far more simple to use animations instead.
It might help to know what concepts with motors you’re struggling with as well. Is it not making sense as a whole or does something with how to manipulate them not make sense?
Hmm, I was thinking about using animations however I’ve got to research it.
Maybe an addon would help?
Every time I try and follow a tutorial I struggle to understand the concept of motors.
I’ve left it for now and turned for the devforum for help.
Often they use addons and they’re not well documented.
If it’s easier to use animations, then that’s the way forward.
motors are basically joints between two parts that allow armatures and rigs to be created and animated with the animation editor, you can inspect the humanoid rig, each part has their motor6d’s with part0 and part1 (basically parts that are connected to each other) also see in the animation editor how they are ordered and how the order affects each other, they are the constructors of an armature, but instead of like most other programs rigs are made of joints and not “bones”.
Animations is a pretty broad term. What kind of animation are you referring to? If it’s animations by the animation editor, said animations require motors, so you wouldn’t be able to animate without motors. Using only the motors on the other hand without animations would be a different concept altogether.
I wrote this relatively simple plugin for creating non humanoid rigs: Non-Humanoid Rig Builder Plugin (For the animation editor)
Your root parts should be the “main” objects. E.g. the body of the car is the root and the wheels are secondary parts.
When you move a root part all of the child connections will also move meaning if your root part is the body of the car your entire model would move when moving the body of the car.
If you’re looking for a script based way to create motors I can help as well.
Also sorry about the messed up icon I haven’t had a chance to fix it.
Animations outside of the scope of Roblox is a broad term, I think it’s pretty easy to understand that I’m referring to Roblox’s Animation object/concept. I don’t really find specifying this to be helpful, sure they use motors, but not in the same sense that people used to use motors or in the way OP is thinking of using them i.e. their DesiredAngle
property.
Technically Roblox’s Animation object should work with any instantiable joint in Roblox. The plugin just builds the rigs using Motor6D
’s because that’s the traditional design and this may have something to do with some built in humanoid functionality.
@E_Link
To be clear. I’m referring to using Roblox’s Animation editor plugin with Roblox’s Animation object. I don’t really care what kind of joints are involved in this because it doesn’t matter as far as I’m aware (correct me if I’m wrong @ScriptingSupport). Of course in order to use the animator plugin you’ll need to rig up your models first, which you would have to do anyway with traditional Motor DesiredAngle manipulation. It looks like @Hexcede has a plugin that might be helpful (I haven’t looked at it.)
To answer your question though @E_Link,
This is by no means a comprehensive or perfect answer so I’m sure people will be able to elaborate a bit better on some of the details I’ll give or that I missed.
Motors are just like any other joint in Roblox. Their main goal is to join two parts together. They have additional features like MaxVelocity and DesiredAngle which differentiate them from most of the other joint objects.
Joints in Roblox have a concept called an “Offset Point.” This Offset Point determines the position and angle of the part that is being joined to another part. The main part in this joint is known as the Root Part, Roblox has a few methods of determining the Root Part. Here’s some documentation around that if you want some light reading Documentation - Roblox Creator Hub
Motors have a few important properties that need to be set. Those properties are Part0, Part1, MaxVelocity, C0, and C1. I’ll briefly go over the purpose of each of these properties as I’ve understood them.
-
Part0
andPart1
are the two parts that are being joined together by the Motor. -
C0
is a coordinate frame (CFrame). This determines the offset point fromPart0
. -
C1
is also a CFrame. This, however, is subtracted fromC0
to determine the offset point forPart1
-
MaxVelocity
is the maximum rotational speed of the motor upon setting itsDesiredAngle
property.
You’ll want to keep in mind that the angle of your joint is very important in how your motor rotates when setting the DesiredAngle
. Using one of the many rigging tools out there would be beneficial in setting up your joints so I would recommend finding one if you have a lot of rigging to do. This process is also necessary for using Roblox’s Animations.
There are more details on the API here: Motor6D | Documentation - Roblox Creator Hub
If you have some more questions let me know.
If you want your vehicle to be physically realistic, I would recommend using a Motor over animations. Assuming you know how to use Hinge Constraints, you can actuate it with a motor. You can put your motor into ‘Servo’, which will essentially attempt to drive the motor to a set angular position. With a door, you could set the door hinge to be 0 when closed, and then open up to 45 degrees when you need it to be open.
Using a HingeConstraint + actuator is far more simple, elegant, and physically realistic than using an animation.
Animations outside of Roblox are the same as within Roblox. Referring to just animations is broad, because you can animate in Roblox with animation objects or custom methods (tweening, math, various constraints, so on). It’s too broad to be used as a term alone.
This is wholly incorrect. Other joints are rigid connections. Animations are designed to work exclusively with Motor6Ds because they use an internal property called Transform. It has nothing to do with Humanoids. AnimationControllers can also run animations.
The intention of a motor joint is to create a movable connection between two parts, which is what Motor6D accomplishes. Humanoids are built with those in mind, to make animations work in the first place. Objects that don’t need to be moved are connected via rigid welds (e.g. accessories).
Angles were used for traditional hard-coded animations using math to set different angles for different positions. Animation objects created via animator plugins don’t use them at all.
Cool. Thanks
Ah right, that actually makes sense. Thanks.
Rigging up the whole vehicle to animate it is going to be a no go.
Guess I’ll stick with motors.