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

How do I make a part face towards the velocity?

Hello, so I made a knife throwing system, but the problem is that the knife does not always face the velocity, I have been searching everywhere for this, but it didn't work,

Script:

local tween = game:GetService("TweenService"):Create(clone,TweenInfo.new((knife.Handle.Position - Frame).Magnitude * 0.3 / 50,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,.2),{Position = Frame})
	
tween:Play()

It's a tween, but I can't seem to make it face like the way it has to: It doesn't rotate lol

btw, I made the knife rotating in it's own script :P

3 comments

0

"Frame" is a variable for mouse.Hit.p

0

Try asking this on the dev forums

1 answer

Here's an idea:

Instead of tweening it to turn it, you could just make it look at the position before it actually starts tweening.

You could do this by using CFrame.new ( Vector3 pos, Vector3 lookAt )

knife.Handle.CFrame = CFrame.new(knife.Handle.Position, Frame)
-- Tween stuff

2 comments

0

It sort of works, but not how I want, the whole knife is a meshpart for the survival knife and the pointy part does not face towards the velocity, which is not what I want

0

It's probably because the front of your knife is not the tip of the knife, so just multiply it by CFrame.Angles and play around with the numbers (example: knife.Handle.CFrame = CFrame.new(knife.Handle.Position, Frame) * CFrame.Angles(0, math.rad(90), 0))

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