Mathy cframe question

Hey guys, right now I’m trying to make an effect where an object that is shot gradually falls towards the ground. As it falls, it’s supposed to turn towards the ground as well.

problem is, it can be turned any number of ways as it’s shot, so it isn’t as simple as just adding CFrame.Angles.

I’m assuming the answer to this is something related to CFrame:ToWorldSpace() or :ToObjectSpace(), but I can’t really figure it out.

To sum up the question - how do I rotate a part towards the ground from any angle?

1 Like

Using CFrames you could create a new target CFrame with lookVector = (0,-1,0) and the position of the projectile and then lerp the projectile CFrame towards the target CFrame.

An alternative is just to use an AlignOrientation constraint in one-attachment mode with the primary axis set to (0,-1,0). You can then choose the max torque & responsiveness to suit the rate at which it should turn.

It’s easier to think in “velocity changing over time”, rather than “rotating toward the ground”.

But first, which of these questions are you asking?:

  • “How do I align an unanchored projectile’s rotation with its current velocity?”, or
  • “How do I update an anchored part’s CFrame every frame so it behaves as though it were affected by physics (and its rotation also follows its current velocity)?”