Hello all,
I’m having a bit of trouble with animating objects for an NPC to pick up.
What I’m essentially trying to do is have an inanimate object, (e.g. a coffee mug) sitting in place on a table, and, after playing an animation on the NPC, the object would be picked up by it.
Here’s an example of an animation I would use without the object moving:
(animation slowed down a bit)
In the time where his arm goes up and touches the block, I would like it to somehow attach to his hand.
I’m somewhat familiar with Motor6Ds and how to use them; the main problem is keeping the block in place and visible before the animation is at the place I want it to be. For example, if I created one between the Left Hand and my block, the block starts moving relative to the arm prematurely like this.
Does anyone know how I might go about making this? Any help is greatly appreciated!
1 Like
From what I see in the last video, before the Animation starts, the Motor6D is already attached to the NPC. To make it work, at the moment when it is supposed to grab the cup (which can be configured in the Animations track with the Keyframes and programmed, if you don’t know about it I recommend that you see the keyframes documentation) make the motor6D attached to the hand
1 Like
To give you an idea of the Keyframes is that in the Animations track you can establish a special point in which something external to the Animations track can happen. These are heard by the KeyframeReached event that brings as a parameter the name you gave your Keyframe.
for example: You make an animation in which an NPC changes face when she sleeps, at the time of Animate when the NPC is about to change her face during the animation, you set a Keyframe in the animation track (right click and rename your keyframe, Roblox Studio will ask you this).
When you are about to program the Keyframe first load the animation as animationTrack in the humanoid
local animationTrack = Humanoid:LoadAnimaction(AnimationInstance)
the Animation track provides you with events, methods and functions that are useful for it, among them, as I mentioned the KeyframeReached that will listen when a Keyframe has run into the animation as follows:
local animationTrack = Humanoid:LoadAnimaction(AnimationInstance)
animationTrack.KeyframeReached:Connect(function(keyframeName)
if keyframeName == "sleep" then
character.Head.face.Texture = "sleeping face id"
end
end)
clearly I should have declared the character but I only put it as an example. but this is a general Idea from Keyframes and KeyframeReached event.
I hope have been helpful! 
5 Likes
This is exactly what I was looking for. Thank you so much for your help!
2 Likes