def _get_posture_constraint(self, strict=False):
     posture_state_constraint = self.body_posture_state_constraint
     posture_state_constraint = posture_state_constraint.get_holster_version()
     if posture_state_constraint.valid and not self.body_state_spec_only:
         carry_left_constraint = carry.create_carry_constraint(self.left.target, Hand.LEFT, strict=strict)
         posture_state_constraint = posture_state_constraint.intersect(carry_left_constraint)
         if posture_state_constraint.valid:
             carry_right_constraint = carry.create_carry_constraint(self.right.target, Hand.RIGHT, strict=strict)
             posture_state_constraint = posture_state_constraint.intersect(carry_right_constraint)
     return posture_state_constraint
def create_put_down_on_ground_constraint(sim, target, terrain_transform, cost=0):
    if cost is None or terrain_transform is None:
        return Nowhere()
    swipe_constraint = CarryingObject.get_carry_transition_position_constraint(terrain_transform.translation, sim.routing_surface)
    carry_constraint = create_carry_constraint(target, debug_name='CarryForPutDownOnGround')
    final_constraint = swipe_constraint.intersect(carry_constraint).intersect(STAND_OR_SIT_CONSTRAINT)
    return final_constraint.generate_constraint_with_cost(cost)
 def _constraint_gen(cls,
                     inst,
                     sim,
                     target,
                     participant_type=ParticipantType.Actor):
     for constraint in super(SuperInteraction, cls)._constraint_gen(
             sim, target, participant_type=participant_type):
         yield constraint
     yield create_carry_constraint(target, debug_name='CarryForPutDown')
 def _constraint_gen(cls,
                     inst,
                     sim,
                     target,
                     participant_type=ParticipantType.Actor):
     for constraint in super(SuperInteraction, cls)._constraint_gen(
             sim, target, participant_type=participant_type):
         yield constraint
     carry_constraint = create_carry_constraint(
         target, debug_name='CarryForAddInWorld')
     total_constraint = carry_constraint.intersect(STAND_OR_SIT_CONSTRAINT)
     yield total_constraint
def create_put_down_on_ground_constraint(sim,
                                         target,
                                         terrain_transform,
                                         cost=0):
    if cost is None or terrain_transform is None:
        return Nowhere()
    swipe_constraint = CarryingObject.get_carry_transition_position_constraint(
        terrain_transform.translation, sim.routing_surface)
    carry_constraint = create_carry_constraint(
        target, debug_name='CarryForPutDownOnGround')
    final_constraint = swipe_constraint.intersect(carry_constraint).intersect(
        STAND_OR_SIT_CONSTRAINT)
    return final_constraint.generate_constraint_with_cost(cost)
 def _constraint_gen(cls,
                     inst,
                     sim,
                     target,
                     participant_type=ParticipantType.Actor):
     for constraint in super(TerrainSuperInteraction, cls)._constraint_gen(
             sim, target, participant_type=participant_type):
         yield constraint
     yield create_carry_constraint(target, debug_name='CarryForPutDown')
     if inst is not None and inst._carry_system_target._starting_transform is not None:
         yield CarryingObject.get_carry_transition_position_constraint(
             inst._carry_system_target._starting_transform.translation,
             sim.routing_surface)
def create_put_down_in_inventory_constraint(inst, sim, target, targets_with_inventory, cost=0):
    if cost is None or not targets_with_inventory:
        return Nowhere()
    carry_constraint = create_carry_constraint(target, debug_name='CarryForPutDownInInventory')
    carry_constraint = carry_constraint.generate_constraint_with_cost(cost)
    object_constraints = []
    for target_with_inventory in targets_with_inventory:
        constraint = target_with_inventory.get_inventory_access_constraint(sim, True, target)
        constraint = constraint.apply_posture_state(None, inst.get_constraint_resolver(None))
        object_constraints.append(constraint)
    final_constraint = create_constraint_set(object_constraints)
    final_constraint = carry_constraint.intersect(final_constraint)
    return final_constraint
def create_put_down_in_inventory_constraint(inst,
                                            sim,
                                            target,
                                            targets_with_inventory,
                                            cost=0):
    if cost is None or not targets_with_inventory:
        return Nowhere()
    carry_constraint = create_carry_constraint(
        target, debug_name='CarryForPutDownInInventory')
    carry_constraint = carry_constraint.generate_constraint_with_cost(cost)
    object_constraints = []
    for target_with_inventory in targets_with_inventory:
        constraint = target_with_inventory.get_inventory_access_constraint(
            sim, True, target)
        constraint = constraint.apply_posture_state(
            None, inst.get_constraint_resolver(None))
        object_constraints.append(constraint)
    final_constraint = create_constraint_set(object_constraints)
    final_constraint = carry_constraint.intersect(final_constraint)
    return final_constraint
 def _constraint_gen(cls, inst, sim, target, participant_type=ParticipantType.Actor):
     for constraint in super(SuperInteraction, cls)._constraint_gen(sim, target, participant_type=participant_type):
         yield constraint
     yield create_carry_constraint(target, debug_name='CarryForPutDown')
     if inst is not None:
         yield inst._carry_system_target.get_constraint(sim)
 def _constraint_gen(cls, inst, sim, target, participant_type=ParticipantType.Actor):
     for constraint in super(TerrainSuperInteraction, cls)._constraint_gen(sim, target, participant_type=participant_type):
         yield constraint
     yield create_carry_constraint(target, debug_name='CarryForPutDown')
     if inst is not None and inst._carry_system_target._starting_transform is not None:
         yield CarryingObject.get_carry_transition_position_constraint(inst._carry_system_target._starting_transform.translation, sim.routing_surface)
 def _constraint_gen(cls, inst, sim, target, participant_type=ParticipantType.Actor):
     for constraint in super(SuperInteraction, cls)._constraint_gen(sim, target, participant_type=participant_type):
         yield constraint
     carry_constraint = create_carry_constraint(target, debug_name='CarryForAddInWorld')
     total_constraint = carry_constraint.intersect(STAND_OR_SIT_CONSTRAINT)
     yield total_constraint