How do you get an animations pose properties?

Is it possible to get all the keyframes of an animation, and see their order and poses inside of them though a animationId?

I’m trying to bind a players camera to an object without the said player being able to rotate the camera at all. The only way I can seem to do this is with the Camera Type Scriptable, I was wondering if there was another way to do this, and if not… what is the best way to move the camera to fit the objects position as it moves?

Everything on the left is what I need to gather the info of.

The CameraType property of a Camera provides a few basic camera modes. If you need anything more specific then you should set the CameraType to Enum.CameraType.Scriptable. You can then implement your own custom camera by binding a function to the render step:

local RunService = game:GetService("RunService")

local function drawCamera(delta: number)
   --You can set the CFrame of the Camera here, assuming it's CameraType is Scriptable
end

RunService:BindToRenderStep("CustomCameraFrame", Enum.RenderPriority.Camera.Value + 1, drawCamera)
--The first string argument can be anything, but should be unique in case you want to unbind the function
1 Like

Does this also include if I want to lock a camera onto an animated part? I just need the orientation to stay at a constant 0,0,0 so it follows the object from one direction. If so, how do you get an animated parts start, and end position?

If you’d like it to lock on an animated part, you can use the Attach camera type and set the camera subject to be the part. This will make the camera be in the same position as the part and face in the same orientation.

If you want it to only follow the position of the part, use the Track camera type (and set the camera subject to the part). This makes the the camera have the same position as the part, but doesn’t influence the camera’s orientation. (I believe you can then just set the camera’s orientation with camera.CFrame = CFrame.Angles(x, y, z).)

1 Like

If that’s the case, how do you get the sequences in the animation for say, a position variable? Say, from an Animation Id. I know that there is one in each animation… it’s just figuring out how to access it.

Once an animation is uploaded it’s not meant to have the keyframe data accessed. If you have it still as keyframes like you have on the left of your screen, you’d get the Pose in each Keyframe with the name of the part you want and get it’s .CFrame property. The property is the offset of the motor6 though, so you’d need to go up the rig structure and get the CFrames for all the other parts too down to the humanoid root part to get a CFrame relative to the humanoid root part/world space.

In general it’s probably a better question as to why you want to do that, since it’s not intended and you shouldn’t ever need to.

Ah, the answer to this is no (besides having the animation play out and reconstructing the key frames, which would be hacky).

You shouldn’t need to do this. If I knew a little more about your use case, I could probably give a more informed suggestion, but you probably want to:

  • Create a new part in your character (add a regular joint connecting to the HRP and make it massless and invisible)
  • Create an animation to animate that part
  • Set the camera to attached
  • Set the camera subject to the part

Then you can animate the camera with the animation for the part.

1 Like

I have gotten a solution, however it wasn’t a conventional solution.

I’m making a camera system that can be animated, without the player being able to move the camera, smoothly. The issue with it, was that the position of the part didn’t move with the animation… as it is technically not moving. I was asking about if there was a way to get all KeyFrame/KeyframeSequences, so you could potentially gain access to the Animation Poses Properties, and see the order of the animation and follow that accordingly.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.