def _is_angle_valid(self, entry_orientation, obj, angle_restriction): rel_orientation = Quaternion.concatenate( sims4.math.invert_quaternion(obj.transform.orientation), entry_orientation) angle = sims4.math.yaw_quaternion_to_angle(rel_orientation) if sims4.math.is_angle_in_between(angle, angle_restriction.start_angle, angle_restriction.end_angle): return True return False
def get_difference_transform(transform_a, transform_b): v = transform_b.translation - transform_a.translation a_q_i = invert_quaternion(transform_a.orientation) q = Quaternion.concatenate(transform_b.orientation, a_q_i) v_prime = Quaternion.transform_vector(a_q_i, v) return Transform(v_prime, q)
def get_orientation(self, obj): if self._tuned_orientation: return Quaternion.concatenate( obj.orientation, angle_to_yaw_quaternion(self._tuned_orientation))