mirror of
https://github.com/APercy/airutils.git
synced 2025-03-21 18:41:21 +00:00
improved copter reactions
This commit is contained in:
parent
0750eb2c9b
commit
400ca59c29
1 changed files with 2 additions and 2 deletions
|
@ -176,7 +176,7 @@ function airutils.logic_heli(self)
|
||||||
local newroll = 0
|
local newroll = 0
|
||||||
local newpitch = 0
|
local newpitch = 0
|
||||||
if ctrl and is_flying then
|
if ctrl and is_flying then
|
||||||
local command_angle = math.rad(8)
|
local command_angle = math.rad(self._tilt_angle or 0)
|
||||||
if ctrl.up then newpitch = -command_angle end
|
if ctrl.up then newpitch = -command_angle end
|
||||||
if ctrl.down then newpitch = command_angle end
|
if ctrl.down then newpitch = command_angle end
|
||||||
if ctrl.left then newroll = -command_angle end
|
if ctrl.left then newroll = -command_angle end
|
||||||
|
@ -242,7 +242,7 @@ function airutils.logic_heli(self)
|
||||||
blade_speed = self._rotor_idle_speed or 12
|
blade_speed = self._rotor_idle_speed or 12
|
||||||
if math.abs(longit_speed) > 0.5 then blade_speed = self._rotor_idle_speed + (self._rotor_speed - self._rotor_idle_speed) / 2 end
|
if math.abs(longit_speed) > 0.5 then blade_speed = self._rotor_idle_speed + (self._rotor_speed - self._rotor_idle_speed) / 2 end
|
||||||
else
|
else
|
||||||
blade_speed = 1 --to avoid division by 0
|
blade_speed = 0.001 --to avoid division by 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local new_accel = airutils.getLiftAccel(self, {x=0, y=velocity.y, z=blade_speed}, {x=0, y=accel.y, z=blade_speed/self.dtime}, blade_speed, roll, curr_pos, self._lift, ceiling, self._wing_span)
|
local new_accel = airutils.getLiftAccel(self, {x=0, y=velocity.y, z=blade_speed}, {x=0, y=accel.y, z=blade_speed/self.dtime}, blade_speed, roll, curr_pos, self._lift, ceiling, self._wing_span)
|
||||||
|
|
Loading…
Add table
Reference in a new issue