check for raycast

This commit is contained in:
Alexsandro Percy 2022-02-03 17:36:37 -03:00
parent 31bff73833
commit 8912e64db2
2 changed files with 12 additions and 2 deletions

View File

@ -286,6 +286,7 @@ minetest.register_entity("automobiles_buggy:buggy", {
_show_rag = true,
_show_lights = false,
_light_old_pos = nil,
_last_ground_check = 0,
get_staticdata = function(self) -- unloaded/unloads ... is now saved
return minetest.serialize({
@ -551,7 +552,11 @@ minetest.register_entity("automobiles_buggy:buggy", {
self._steering_angle / 30 * turn_rate * automobiles_lib.sign(longit_speed)
end
self._last_ground_check = self._last_ground_check + dtime
if self._last_ground_check > 0.15 then
self._last_ground_check = 0
automobiles_lib.ground_get_distances(self, 0.372, 2.3)
end
--[[if player and is_attached then
player:set_look_horizontal(newyaw)

View File

@ -268,6 +268,7 @@ minetest.register_entity("automobiles_roadster:roadster", {
_show_rag = true,
_show_lights = false,
_light_old_pos = nil,
_last_ground_check = 0,
get_staticdata = function(self) -- unloaded/unloads ... is now saved
return minetest.serialize({
@ -524,7 +525,11 @@ minetest.register_entity("automobiles_roadster:roadster", {
self._steering_angle / 30 * turn_rate * automobiles_lib.sign(longit_speed)
end
self._last_ground_check = self._last_ground_check + dtime
if self._last_ground_check > 0.15 then
self._last_ground_check = 0
automobiles_lib.ground_get_distances(self, 0.5, 2.422)
end
--[[if player and is_attached then
player:set_look_horizontal(newyaw)