---begin pitch calculation
--feed a 2D coordinate flipped into dir to yaw to calculate pitch
head_rotation.x = degrees(minetest.dir_to_yaw(vector.new(vector.distance(vector.new(pos.x,0,pos.z),vector.new(pos2.x,0,pos2.z)),0,pos.y-pos2.y))+(math.pi/2))
+ if self.flip_pitch then
+ head_rotation.x = head_rotation.x * -1
+ end
head_rotation.z = head_yaw
self.object:set_bone_position(self.head_bone, head_position, head_rotation)
return(true)
--print(self.head_rotation.y)
--if passed a direction to look
local pos = self.object:get_pos()
- local body_yaw = self.object:get_yaw()-math.pi/2
+ local body_yaw = self.object:get_yaw()-math.pi/2+self.rotational_correction
local dir = vector.multiply(minetest.yaw_to_dir(body_yaw),self.head_directional_offset)
---begin pitch calculation
--feed a 2D coordinate flipped into dir to yaw to calculate pitch
head_rotation.x = degrees(minetest.dir_to_yaw(vector.new(vector.distance(vector.new(pos.x,0,pos.z),vector.new(pos2.x,0,pos2.z)),0,pos.y-pos2.y))+(math.pi/2))
+ if self.flip_pitch then
+ head_rotation.x = head_rotation.x * -1
+ end
head_rotation.y = -head_yaw
self.object:set_bone_position(self.head_bone, head_position, head_rotation)
return(true)