mirror of
https://github.com/APercy/automobiles_pck
synced 2025-08-22 12:55:49 +02:00
Merge pull request #19 from jeremyshannon/main
Use add_velocity instead of set_velocity, to get rid of movement jitter
This commit is contained in:
commit
c7e74ddaf7
@ -7,9 +7,9 @@ function automobiles_lib.physics(self)
|
||||
-- dumb friction
|
||||
if self.isonground and not self.isinliquid then
|
||||
--minetest.chat_send_all('okay')
|
||||
self.object:set_velocity({x=vel.x*friction,
|
||||
y=vel.y,
|
||||
z=vel.z*friction})
|
||||
self.object:add_velocity({x=vel.x - vel.x*friction,
|
||||
y=0,
|
||||
z=vel.z - vel.z*friction})
|
||||
end
|
||||
|
||||
-- bounciness
|
||||
@ -33,7 +33,7 @@ function automobiles_lib.physics(self)
|
||||
self.collided = false
|
||||
end
|
||||
|
||||
self.object:set_velocity(vnew)
|
||||
self.object:add_velocity(vector.subtract(vel, vnew))
|
||||
end
|
||||
|
||||
-- buoyancy
|
||||
|
@ -98,7 +98,8 @@ function automobiles_lib.ground_get_distances(self, radius, axis_distance)
|
||||
self._last_front_detection = rear_obstacle_level.y
|
||||
--here we need to set the collision effect
|
||||
self.object:set_acceleration({x=0,y=0,z=0})
|
||||
self.object:set_velocity({x=0,y=0,z=0})
|
||||
local oldvel = self.object:get_velocity()
|
||||
self.object:add_velocity(vector.subtract(vector.new(), oldvel))
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user