I am trying to make a holming projectile using heartbeat event, so im describing its positions and orientations with CFrame. Its working well but now I want to add holming effect, and I have no idea of how to make the Orientation add half, or 1/5 of the way to facing another part direction.
I know how to describe the orientation to face another part in a single row in plenty ways, but half? Help
What does holming mean? Is it the old Welsh practice of slashing female servants and late risers with holly branches?
Jokes aside, it is best to use CFrame.Angles
for this task.
It is used something like this (lets assume your part is called projectile):
projectile.CFrame = projectile.CFrame * CFrame.Angles(rot1,rot2,rot3)
Replace one of rot1 rot2 rot3
with angle in radians. Rest of them should be set to 0
, if you only want rotation on one axis. Which one of those you need to set, depends on your default projectile rotation.
Example, rotating projectile by 30 degrees:
projectile.CFrame = projectile.CFrame * CFrame.Angles(math.rad(30),0,0)
I solved this with :Lerp()
arrow.CFrame = arrow.CFrame:Lerp(CFrame.new(arrow.Position, Target.Position), 1/10)