WIP: boats: rotate boat driver, during boat rotation

Currently during boat rotation, the boat driver view do not change.
With this simple patch the rotation is made also for driver.

This way is more natural for vehicles (cars, carts, boats, airplanes etc.)
This commit is contained in:
Bartosz Kosiorek 2020-04-20 16:27:41 +02:00
parent 52c6921cb2
commit afbee2845a

View file

@ -159,14 +159,18 @@ function boat.on_step(self, dtime)
if ctrl.left then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
driver_objref:set_look_horizontal(driver_objref:get_look_horizontal() - dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
driver_objref:set_look_horizontal(driver_objref:get_look_horizontal() + dtime * 0.9)
end
elseif ctrl.right then
if self.v < -0.001 then
self.object:set_yaw(self.object:get_yaw() + dtime * 0.9)
driver_objref:set_look_horizontal(driver_objref:get_look_horizontal() + dtime * 0.9)
else
self.object:set_yaw(self.object:get_yaw() - dtime * 0.9)
driver_objref:set_look_horizontal(driver_objref:get_look_horizontal() - dtime * 0.9)
end
end
end