accel methos inside flight step

master
Alexsandro Percy 2021-12-06 18:58:19 -03:00
parent 19512c1fbb
commit ce2da66f13
2 changed files with 8 additions and 5 deletions

View File

@ -35,7 +35,7 @@ function supercub.physics(self)
local accell = self._last_accell
accell.y = accell.y + mobkit.gravity
--accell.y = accell.y + mobkit.gravity
self.water_drag = 0.1
mobkit.set_acceleration(self.object,{x=0,y=0,z=0})
@ -44,7 +44,7 @@ function supercub.physics(self)
--self.object:set_velocity(new_velocity)
new_velocity = vector.add(vel, vector.multiply(accell, self.dtime))
self.object:set_pos(self.object:get_pos())
--self.object:set_pos(self.object:get_pos())
--[[
accell correction
@ -69,7 +69,7 @@ function supercub.physics(self)
else
--self.object:set_velocity(new_velocity)
self.object:set_acceleration(accell)
--self.object:set_acceleration(accell)
end
end

View File

@ -307,7 +307,7 @@ function supercub.testImpact(self, velocity, position)
end
end
if impact > 1 then
if impact > 1.2 then
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-2.8}))
if (noded and noded.drawtype ~= 'airlike') then
minetest.sound_play("supercub_touch", {
@ -645,7 +645,7 @@ function supercub.flightstep(self)
if accel == nil then accel = {x=0,y=0,z=0} end
--lift calculation
--accel.y = accel_y --accel.y + mobkit.gravity --accel_y
accel.y = accel.y + mobkit.gravity --accel_y
--lets apply some bob in water
if self.isinliquid then
@ -666,6 +666,9 @@ function supercub.flightstep(self)
if stop ~= true then --maybe == nil
self._last_accell = new_accel
self.object:set_pos(curr_pos)
self.object:set_velocity(velocity)
mobkit.set_acceleration(self.object, new_accel)
else
if stop == true then
self.object:set_acceleration({x=0,y=0,z=0})