It’s a pretty basic approach but in theory you could handle the vertical angle somewhat like the following code. The change in angle would be constant, however you could use a fancy equation to improve that.
local DROP_SPEED = 100 -- degrees per second
local END_ANGLE = 180 -- straight down
local StartAngle -- determined by where you shoot
local AngleDifference = END_ANGLE- StartAngle
if AngleDifference < 0 then
-- make end negative so it lerps straight to the end angle (anticlockwise) instead of going the long way
AngleDifference = (-END_ANGLE) - StartAngle
end
local TotalTime = AngleDifference / DROP_SPEED -- total time to get from start angle to end angle
local StartTime = tick()
-- every frame (or 0.3 seconds or whatever you like)
local CurrentAlpha = (tick() - StartTime) / TotalTime -- apply your fancy equation here
local CurrentAngle = lerp(StartAngle, EndAngle, CurrentAlpha)
-- actually change the angle of the part
I don’t do much of this stuff so I’m not 100% sure it’ll work good but it seems to work out in my head
Okay so I got it moving nicely using @Polymorphic’s and @magnalite’s SUVAT suggestions (can’t believe I forgot about those xd).
Issue I’m having now is getting the direction it should come out at. Like if I click, I want it to come out at the angle I clicked at, if that makes sense?
Edit: Good chance I was just dumb and can simply raycast and then get the unit vector between where I clicked and the humanoidrootpart.