I want to have a better understanding of how animation is made.
Specifically. I want to be able to use external objects in player animations, such as lifting and holding a crate or grabbing a weapon.
What is the issue?
I don’t understand how using objects/models with animations work in the way that they are targeted.
You can watch the video for a visual on what I mean if you don’t understand.
I don’t think the third question is relevant here so I will skip it.
I am currently using the new megmo animator, and I used the “Add track > Model” feature to add the crate seen in the video to the timeline of the animation.
It works for the dummy that I used to make it, but I don’t know how I can set the model to a different one based on what crate you try to lift.
Even if you don’t know how the megmo animator works in this regard, it would still help for me to know how this is achieved without it, as then I could at least try to come up with a plan myself.
If they are parented to the same model as the animator, their animations will play as well.
I, for example, have a setup where the hand view model is always the same, but you parent items to it
This way both hand and item animation will play.
I don’t understand if you are talking about the welding (parenting) part or the animation itself.
About the animation itself, I simply put both view models at the world origin and then the item at the position it will be welded at, then exported them into Blender and built their rigs (skipping building the hand rig if one already exists) and then parent the item’s rig to the hand rig and start animating.
I usually have the “Grip” bone under the right arm of the view model, for example, and this is where the item is attached using RigIdConstraint, and this also lets me easily animate the grip bone as well for grenade throwing animation, for example
Then I export both animations separately and merge them using a plugin, “Animation Combiner” I made a while back
Then this merged animation can be played under the hand’s animator, and the item part will start playing once the item’s model is parented to the hand model.
Sorry if I was a little unclear, I myself am not exactly sure of what the “issue” is.
The end result is that I can pick up boxes in the animation and they stay carried until the player drops them via the scripts that I made.
(3 animations total: pick up, idle, put down)
Here are some questions that I have that I am quite confused over:
Animating one object is done by giving the object an animator right?
But if an animation contains more than one separate objects, do both objects need animators for the one animation to work? Or do you only need 1 “host” animator to manipulate the other object?
How does the animation know what specific object is supposed to be animated?
How can I change the expected object based on the model that is being interacted with through script?
(^ Example: There is my animation for lifting a crate, but your not only going to be lifting one specific crate. The selected crate should change based on which one you are interacting with through scripting.)
I hope that is a little more clear and I apologize for being unspecific; I am mainly a coder and have very little experience animating.
Thanks for responding! I tried using a motor6d, which made the crate appear on the base roblox animation editor, but the crate wouldn’t move when I changed it’s position in the editor and played it.
Contextual info:
The crate is a model that is parented to the rig, and the same happens when a player picks up a crate.
The crate is made up of a center part with 3 unions for the details.
The center part is set as the primarypart of the crate.
The motor6d is parented to the rig’s torso, with part0 being the torso itself and part1 being the center basepart of the crate model. No other properties were changed excluding name.
The roblox animation editor gave me a warning that the crate Center part was anchored which would mess the animation up, so I unanchored all of the parts in the crate model and welded the unions to the center.
Unfortunately it still did not let me change it’s position in the test animation.
For anyone curious as well, I figured it out myself after finding another post about motor6d’s.
How to animate using a player and object/tool:
Making the animation:
Make sure the object is a Model with a primarypart set AND UNANCHORED. Use weldconstraints to keep everything together and connected.
(Note: You only need to unanchor everything in the model during the time you want it animated. Otherwise you can anchor it again after.)
Parent the model of the object/tool under the player’s character/the model of the target of the animation (the rig in this case).
On the model/rig you are using to make the animation, create a motor3d with part0 as whatever part on the player/model/rig that you want the object/tool to move along with.
(if you want it to move with the player/rig’s right hand, set it to that. If it’s more complicated and you only want to move it with animation use the humanoidrootpart.)
Set the part1 to the primarypart of the object/tool’s model. This may teleport the object/tool to the central location of part0; just move it back to where you want it when the animation starts.
Moving the object/tool after the motor6d is correctly set up will set the P0/P1 to the offset you gave it automatically so you don’t need to do anything else.
When you go to make the animation, under the rig/model area where it lists all the body parts, you should see one with the same name as the primarypart of the object/tool.
Insert a keyframe at the start of the animation and you should be able to animate it along with the body.
Using the animation:
Parent the object/tool under the player/model that is hosting the animation.
Set up a trigger that makes the animator of the player/model actually play the animation you created using it’s animationID that you get when you publish it.
Before the script that runs the animation happens, make a motor6d under the object and set the values “part0, part1, p0, p1” to the EXACT SAME SETTINGS as the one used to make the animation.
Play the animation. If you did everything correctly, it should work out!