Back with sensible rotation only.

The pitch was fine, but the roll was implemented in a ridiculous
manner. More importantly, both pitch and roll triggered a minetest
bug which left the player model madly orientated for ever once
they left the helicopter. I'll probably put in sensible pitch/roll
if I fix the core bug.
This commit is contained in:
Ciaran Gultnieks 2014-03-05 21:04:54 +00:00
parent 0886cc41a9
commit d07e12df60

@ -214,7 +214,20 @@ function heli:on_step(dtime)
if math.abs(self.vy) > 4.5 then
self.vz = 4.5*get_sign(self.vz)
end
--Model rotation
if self.driver then
attachpos = {
x=-(self.driver:getpos().x-self.object:getpos().x)*dtime,
y=-(self.driver:getpos().z-self.object:getpos().z)*dtime,
z=-(self.driver:getpos().y-self.object:getpos().y)*dtime
}
else
attachpos = {x=0, y=0, z=0}
end
self.model:set_attach(self.object,"Root", attachpos,
{x=-90, y=0, z=self.yaw*57})
--Set speed to entity
self.object:setvelocity({x=self.vx, y=self.vy,z=self.vz})