1
This commit is contained in:
commit
a85391509d
211 files changed
+28903
No files matched your search
@@ -0,0 +1,27 @@
|
||||
--!strict
|
||||
local LootMagnet = {Radius = 12, Duration = .38}
|
||||
|
||||
function LootMagnet.canReach(playerPosition: Vector3, dropPosition: Vector3, radius: number, geometry: RaycastParams): boolean
|
||||
local delta = dropPosition - playerPosition
|
||||
local distance = delta.Magnitude
|
||||
return distance <= radius and (distance < .01 or workspace:Raycast(playerPosition, delta, geometry) == nil)
|
||||
end
|
||||
|
||||
function LootMagnet.curve(start: Vector3, target: Vector3, elapsed: number, angle: number): (Vector3, number)
|
||||
local progress = math.clamp(elapsed / LootMagnet.Duration, 0, 1)
|
||||
local t = progress ^ 1.65
|
||||
local side = Vector3.new(math.cos(angle), 0, math.sin(angle)) * 1.5
|
||||
local bend = start:Lerp(target, .35) + Vector3.yAxis * 2.85 + side
|
||||
return start:Lerp(bend, t):Lerp(bend:Lerp(target, t), t), progress
|
||||
end
|
||||
|
||||
function LootMagnet.catchPoint(character: Model?, camera: Camera?): Vector3?
|
||||
local head = character and character:FindFirstChild("Head")
|
||||
if head and head:IsA("BasePart") and camera and (camera.CFrame.Position - head.Position).Magnitude < 3 then
|
||||
return (camera.CFrame * CFrame.new(.43, -.48, -1.7)).Position
|
||||
end
|
||||
local root = character and character.PrimaryPart
|
||||
return if root then root.Position + Vector3.yAxis * 1.35 else nil
|
||||
end
|
||||
|
||||
return table.freeze(LootMagnet)
|
||||
Reference in new issue
Block a user