Improve acceleration & velocity physics
parent
7fb810d30b
commit
eb1a0c8e0f
|
@ -79,14 +79,14 @@ function hover:register_hovercraft(name, def)
|
|||
self.thrust = self.thrust + self.acceleration
|
||||
end
|
||||
local velocity = hover:get_velocity(self.thrust, self.velocity.y, 0, yaw)
|
||||
if velocity.x < self.velocity.x then
|
||||
if velocity.x < self.velocity.x - self.acceleration then
|
||||
self.velocity.x = self.velocity.x - self.acceleration
|
||||
elseif velocity.x > self.velocity.x then
|
||||
elseif velocity.x > self.velocity.x + self.acceleration then
|
||||
self.velocity.x = self.velocity.x + self.acceleration
|
||||
end
|
||||
if velocity.z < self.velocity.z then
|
||||
if velocity.z < self.velocity.z - self.acceleration then
|
||||
self.velocity.z = self.velocity.z - self.acceleration
|
||||
elseif velocity.z > self.velocity.z then
|
||||
elseif velocity.z > self.velocity.z + self.acceleration then
|
||||
self.velocity.z = self.velocity.z + self.acceleration
|
||||
end
|
||||
if not self.sound then
|
||||
|
|
5
init.lua
5
init.lua
|
@ -30,8 +30,8 @@ hover:register_hovercraft("hovercraft:hover_green" ,{
|
|||
inventory_image = "hovercraft_green_inv.png",
|
||||
max_speed = 8,
|
||||
acceleration = 0.25,
|
||||
deceleration = 0.25,
|
||||
jump_velocity = 5.0,
|
||||
deceleration = 0.15,
|
||||
jump_velocity = 5.5,
|
||||
fall_velocity = 1.5,
|
||||
bounce = 0.5,
|
||||
})
|
||||
|
@ -47,3 +47,4 @@ hover:register_hovercraft("hovercraft:hover_yellow" ,{
|
|||
fall_velocity = 0.5,
|
||||
bounce = 0.25,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue