add game&rawdata

This commit is contained in:
Vasily Petrov 2026-06-17 23:06:51 +03:00
parent 0133cd976c
commit 49b34b5546
45731 changed files with 709831 additions and 0 deletions

View file

@ -0,0 +1,53 @@
--[[------------------------------------------------------------------------------------------------
Helicopter look
Àíäðóùåíêî Èâàí
--------------------------------------------------------------------------------------------------]]
local heli_looker = {}
function get_heli_looker(obj)
if heli_looker[obj:id()] == nil then
heli_looker[obj:id()] = heli_look(obj)
end
return heli_looker[obj:id()]
end
class "heli_look"
function heli_look:__init(obj)
self.obj = obj
self.look_point = vector():set(0,0,0)
self.look_state = false
end
function heli_look:calc_look_point(dest_point, look_state)
self.look_state = look_state
if look_state and dest_point then
local heli = self.obj:get_helicopter()
local dist_to_dest_point = heli:GetDistanceToDestPosition()
local new_direction = vector():set(0,0,0) --' åä. âåêòîð çàäàííîãî íàïðàâëåíèÿ
local curr_heli_position = self.obj:position() --' òåêóùàÿ ïîçèöèÿ
local curr_heli_direction = self.obj:direction() --' åäèíè÷íûé âåêòîð òåêóùåãî íàïðàâëåíèÿ
local heli_velocity = heli:GetSpeedInDestPoint(0)
local curr_heli_velocity = heli:GetCurrVelocity() --' òåêóùàÿ ñêîðîñòü
new_direction.x = (dest_point.x - curr_heli_position.x)/dist_to_dest_point
new_direction.y = (dest_point.y - curr_heli_position.y)/dist_to_dest_point
new_direction.z = (dest_point.z - curr_heli_position.z)/dist_to_dest_point
local delta
if heli_velocity <= 0 then
delta = 0
else
delta = curr_heli_velocity/heli_velocity
if delta > 2 then
delta = 2
end
end
self.look_point.x = heli_velocity^2 * (curr_heli_direction.x + new_direction.x / 2 * (2 - delta))
self.look_point.y = heli_velocity^2 * (curr_heli_direction.y + new_direction.y / 2 * (2 - delta))
self.look_point.z = heli_velocity^2 * (curr_heli_direction.z + new_direction.z / 2 * (2 - delta))
heli:LookAtPoint( self.look_point, look_state )
end
end