local set_animation = defense_mob_api.library.set_animation

function defense_mob_api.library.jump(self, direction)
	if self.standing
	then
		if direction
		then
			direction.y = 0.1
			direction = vector.normalize(direction)
		else
			direction = {x = 0, y = 0, z = 0}
		end

		local v = self.object:getvelocity()
		v.y = math.sqrt(2 * -self.gravity * (self.jump_height + 0.2))
		v.x = direction.x * self.jump_height
		v.z = direction.z * self.jump_height
		self.object:setvelocity(vector.add(self.object:getvelocity(), v))

		set_animation(self, "jump")
	end
end
