mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
improvement on wind lift
This commit is contained in:
parent
534b02bf5d
commit
e330f86ba3
2 changed files with 7 additions and 5 deletions
10
init.lua
10
init.lua
|
@ -237,13 +237,15 @@ end
|
|||
-- wingspan: for ground effect calculation
|
||||
function airutils.getLiftAccel(self, velocity, accel, longit_speed, roll, curr_pos, lift, max_height, wingspan)
|
||||
--add wind to the lift calcs
|
||||
local wind = airutils.get_wind(curr_pos, 2.0)
|
||||
local accel_wind = vector.subtract(accel, wind) --why? because I need to fake more speed when against the wind to gain lift
|
||||
local new_velocity = vector.add(vector.multiply(accel_wind, self.dtime),velocity)
|
||||
local wind = airutils.get_wind(curr_pos, 10)
|
||||
local accel_wind = vector.subtract(accel, wind) --why? because I need to fake more speed when against the wind to gain lift
|
||||
local vel_wind = vector.multiply(accel_wind, self.dtime)
|
||||
local new_velocity = vector.add(velocity, vel_wind)
|
||||
|
||||
--[[local hull_direction = airutils.rot_to_dir(self.object:get_rotation())
|
||||
local wind_yaw = minetest.dir_to_yaw(wind)
|
||||
local orig_vel = vector.dot(velocity,hull_direction)
|
||||
local new_vel = vector.dot(new_velocity,hull_direction)
|
||||
local new_vel = vector.dot(vel_wind,hull_direction)
|
||||
if orig_vel > new_vel then
|
||||
orig_vel = core.colorize('#00ff00', orig_vel)
|
||||
new_vel = core.colorize('#ff0000', new_vel)
|
||||
|
|
2
wind.lua
2
wind.lua
|
@ -50,7 +50,7 @@ else
|
|||
local yaw = minetest.dir_to_yaw(airutils.wind.wind)
|
||||
local yaw = yaw+math.random()-0.5
|
||||
airutils.wind.wind = vector.multiply(minetest.yaw_to_dir(yaw),4)
|
||||
airutils.wind.ttime = wind.timer+math.random()*5*60+1*60
|
||||
airutils.wind.ttime = airutils.wind.timer+math.random()*5*60+1*60
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue