mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-10 00:59:35 +01:00
Use correct vectors for look directions east/west
This commit is contained in:
parent
cea82c07f8
commit
524fe37f4a
1 changed files with 7 additions and 1 deletions
|
@ -250,6 +250,12 @@ local function direction_away_from_players(staticdata)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local look_directions = {
|
||||||
|
mod.north,
|
||||||
|
mod.west,
|
||||||
|
mod.south,
|
||||||
|
mod.east,
|
||||||
|
}
|
||||||
local function calculate_acceleration(staticdata)
|
local function calculate_acceleration(staticdata)
|
||||||
local acceleration = 0
|
local acceleration = 0
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ local function calculate_acceleration(staticdata)
|
||||||
|
|
||||||
if (ctrl.forward or 0) > time_active then
|
if (ctrl.forward or 0) > time_active then
|
||||||
if staticdata.velocity == 0 then
|
if staticdata.velocity == 0 then
|
||||||
local look_dir = minetest.facedir_to_dir(ctrl.look or 0)
|
local look_dir = look_directions[ctrl.look or 0]
|
||||||
local dot = vector.dot(staticdata.dir, look_dir)
|
local dot = vector.dot(staticdata.dir, look_dir)
|
||||||
if dot < 0 then
|
if dot < 0 then
|
||||||
reverse_direction(staticdata)
|
reverse_direction(staticdata)
|
||||||
|
|
Loading…
Reference in a new issue