Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a part turn its direction half way to another part?

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

2 answers

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)

2 comments

0

This look like it would rotate the projectile in a given direction, but it doesnt make me able to rotate relative to another parts direction, that I dont know what direction is in code. I solved with lerp below

0

Holming is like a guided missile lol

I solved this with :Lerp()

arrow.CFrame = arrow.CFrame:Lerp(CFrame.new(arrow.Position, Target.Position), 1/10)	

This discussion is preserved as it was. New answers, comments, and votes are closed.