Changed the rope calculation (not working like i want anyway)

This commit is contained in:
bizcochito 2022-02-11 15:55:14 +01:00
parent ff99b79563
commit d7d0c83c94
1 changed files with 5 additions and 2 deletions

View File

@ -194,9 +194,12 @@ function Player:DoPhysics()
if self.isHooked then
local hook = Vector(self.pos.x, self.pos.y, self.hookAnchor.x, self.hookAnchor.y)
if GetVectorValue(hook) > self.hookedDistance then
self.canFall = false
local hook_angle = GetAngleFromVector(hook[1],hook[2])
self.pos.x = self.hookAnchor.x + self.hookedDistance * math.cos(-math.rad(180)+hook_angle)
self.pos.y = self.hookAnchor.y + self.hookedDistance * math.sin(-math.rad(180)+hook_angle)
--pos_x = self.hookAnchor.x + self.hookedDistance * math.cos(-math.rad(180)+hook_angle) + ((gravity ^ 2)/2) * math.sin(hook_angle)
--pos_y = self.hookAnchor.y + self.hookedDistance * math.sin(-math.rad(180)+hook_angle) + ((gravity ^ 2)/2) * math.cos(hook_angle)
self.vel.x = self.vel.x + gravity * (-math.sin(hook_angle))
self.vel.y = self.vel.y + gravity * math.cos(hook_angle)
end
end