unreal.PhysicsConstraintComponent

class unreal.PhysicsConstraintComponent(outer: Object | None = None, name: Name | str = 'None')

Bases: SceneComponent

This is effectively a joint that allows you to connect 2 rigid bodies together. You can create different types of joints using the various parameters of this component.

C++ Source:

  • Module: Engine

  • File: PhysicsConstraintComponent.h

Editor Properties: (see get_editor_property/set_editor_property)

  • absolute_location (bool): [Read-Write] If RelativeLocation should be considered relative to the world, rather than the parent

  • absolute_rotation (bool): [Read-Write] If RelativeRotation should be considered relative to the world, rather than the parent

  • absolute_scale (bool): [Read-Write] If RelativeScale3D should be considered relative to the world, rather than the parent

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_name1 (ConstrainComponentPropName): [Read-Write] Name of first component property to constrain. If Actor1 is NULL, will look within Owner. If this is NULL, will use RootComponent of Actor1

  • component_name2 (ConstrainComponentPropName): [Read-Write] Name of second component property to constrain. If Actor2 is NULL, will look within Owner. If this is NULL, will use RootComponent of Actor2

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • constraint_actor1 (Actor): [Read-Write] Pointer to first Actor to constrain.

  • constraint_actor2 (Actor): [Read-Write] Pointer to second Actor to constrain.

  • constraint_instance (ConstraintInstance): [Read-Write] All constraint settings

  • detail_mode (DetailMode): [Read-Write] If detail mode is >= system detail mode, primitive won’t be rendered.

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • hidden_in_game (bool): [Read-Write] Whether to hide the primitive in game, if the primitive is Visible.

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • mobility (ComponentMobility): [Read-Write] How often this component is allowed to move, used to make various optimizations. Only safe to set in constructor.

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • on_constraint_broken (ConstraintBrokenSignature): [Read-Write] Notification when constraint is broken.

  • on_plastic_deformation (PlasticDeformationEventSignature): [Read-Write] Notification when constraint plasticity drive target changes.

  • physics_volume_changed_delegate (PhysicsVolumeChanged): [Read-Write] Delegate that will be called when PhysicsVolume has been changed *

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • relative_location (Vector): [Read-Write] Location of the component relative to its parent

  • relative_rotation (Rotator): [Read-Write] Rotation of the component relative to its parent

  • relative_scale3d (Vector): [Read-Write] Non-uniform scaling of the component relative to its parent. Note that scaling is always applied in local space (no shearing etc)

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

  • should_update_physics_volume (bool): [Read-Write] Whether or not the cached PhysicsVolume this component overlaps should be updated when the component is moved. see: GetPhysicsVolume()

  • use_attach_parent_bound (bool): [Read-Write] If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together.

  • visible (bool): [Read-Write] Whether to completely draw the primitive; if false, the primitive is not drawn, does not cast a shadow.

break_constraint() None

Break this constraint

get_constrained_components() -> (out_component1=PrimitiveComponent, out_bone_name1=Name, out_component2=PrimitiveComponent, out_bone_name2=Name)

Get connected components and potential related attachement bones

Returns:

out_component1 (PrimitiveComponent):

out_bone_name1 (Name):

out_component2 (PrimitiveComponent):

out_bone_name2 (Name):

Return type:

tuple

get_constraint() ConstraintInstanceAccessor

Gets the constraint object

Return type:

ConstraintInstanceAccessor

get_constraint_force() -> (out_linear_force=Vector, out_angular_force=Vector)

Retrieve the constraint force most recently applied to maintain this constraint. Returns 0 forces if the constraint is not initialized or broken.

Returns:

out_linear_force (Vector):

out_angular_force (Vector):

Return type:

tuple

get_current_swing1() float

Gets the current Swing1 of the constraint

Return type:

float

get_current_swing2() float

Gets the current Swing2 of the constraint

Return type:

float

get_current_twist() float

Gets the current Angular Twist of the constraint

Return type:

float

is_broken() bool

Retrieve the status of constraint being broken.

Return type:

bool

property on_constraint_broken: ConstraintBrokenSignature

[Read-Write] Notification when constraint is broken.

Type:

(ConstraintBrokenSignature)

property on_plastic_deformation: PlasticDeformationEventSignature

[Read-Write] Notification when constraint plasticity drive target changes.

Type:

(PlasticDeformationEventSignature)

set_angular_breakable(angular_breakable, angular_break_threshold) None

Sets the Angular Breakable properties

Parameters:
  • angular_breakable (bool) – Whether it is possible to break the joint with angular force

  • angular_break_threshold (float) – Torque needed to break the joint

set_angular_drive_mode(drive_mode) None

Switches the angular drive mode between SLERP and Twist And Swing

Parameters:

drive_mode (AngularDriveMode) – The angular drive mode to use. SLERP uses shortest spherical path, but will not work if any angular constraints are locked. Twist and Swing decomposes the path into the different angular degrees of freedom but may experience gimbal lock

set_angular_drive_params(position_strength, velocity_strength, force_limit) None

Sets the drive params for the angular drive.

Parameters:
  • position_strength (float) – Positional strength for the drive (stiffness)

  • velocity_strength (float) – Velocity strength of the drive (damping)

  • force_limit (float) – Max force applied by the drive

set_angular_orientation_drive(enable_swing_drive, enable_twist_drive) None

Enables/Disables angular orientation drive. Only relevant if the AngularDriveMode is set to Twist and Swing deprecated: Use SetOrientationDriveTwistAndSwing instead.

Parameters:
  • enable_swing_drive (bool) – Indicates whether the drive for the swing axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing

  • enable_twist_drive (bool) – Indicates whether the drive for the twist axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing

set_angular_orientation_target(pos_target) None

Sets the target orientation for the angular drive.

Parameters:

pos_target (Rotator) – Target orientation

set_angular_plasticity(angular_plasticity, angular_plasticity_threshold) None

Sets the Angular Plasticity properties

Parameters:
  • angular_plasticity (bool) – Whether it is possible to reset the target angle from the angular displacement

  • angular_plasticity_threshold (float) – Degrees needed to reset the rest state of the joint

set_angular_swing1_limit(motion_type, swing1_limit_angle) None

Sets the Angular Swing1 Motion Type

Parameters:
set_angular_swing2_limit(motion_type, swing2_limit_angle) None

Sets the Angular Swing2 Motion Type

Parameters:
set_angular_twist_limit(constraint_type, twist_limit_angle) None

Sets the Angular Twist Motion Type

Parameters:
set_angular_velocity_drive(enable_swing_drive, enable_twist_drive) None

Set Angular Velocity Drive deprecated: Use SetAngularVelocityDriveTwistAndSwing instead.

Parameters:
  • enable_swing_drive (bool) –

  • enable_twist_drive (bool) –

set_angular_velocity_drive_slerp(enable_slerp) None

Enables/Disables the angular velocity slerp drive. Only relevant if the AngularDriveMode is set to SLERP

Parameters:

enable_slerp (bool) – Indicates whether the SLERP drive should be enabled. Only relevant if the AngularDriveMode is set to SLERP

set_angular_velocity_drive_twist_and_swing(enable_twist_drive, enable_swing_drive) None

Enables/Disables angular velocity twist and swing drive. Only relevant if the AngularDriveMode is set to Twist and Swing

Parameters:
  • enable_twist_drive (bool) – Indicates whether the drive for the twist axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing

  • enable_swing_drive (bool) – Indicates whether the drive for the swing axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing

set_angular_velocity_target(vel_target) None

Sets the target velocity for the angular drive.

Parameters:

vel_target (Vector) – Target velocity

set_constrained_components(component1, bone_name1, component2, bone_name2) None

Directly specify component to connect. Will update frames based on current position.

Parameters:
set_constraint_reference_frame(frame, ref_frame) None

Pass in reference frame in. If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Parameters:
set_constraint_reference_orientation(frame, pri_axis, sec_axis) None

Pass in reference orientation in (maintains reference position). If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Parameters:
set_constraint_reference_position(frame, ref_position) None

Pass in reference position in (maintains reference orientation). If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Parameters:
set_contact_transfer_scale(contact_transfer_scale) None

Sets the contact transfer scale properties

Parameters:

contact_transfer_scale (float) – Set the contact transfer scale for the parent of the joint

set_disable_collision(disable_collision) None

If true, the collision between the two rigid bodies of the constraint will be disabled.

Parameters:

disable_collision (bool) –

set_linear_breakable(linear_breakable, linear_break_threshold) None

Sets the Linear Breakable properties

Parameters:
  • linear_breakable (bool) – Whether it is possible to break the joint with linear force

  • linear_break_threshold (float) – Force needed to break the joint

set_linear_drive_params(position_strength, velocity_strength, force_limit) None

Sets the drive params for the linear drive.

Parameters:
  • position_strength (float) – Positional strength for the drive (stiffness)

  • velocity_strength (float) – Velocity strength of the drive (damping)

  • force_limit (float) – Max force applied by the drive

set_linear_plasticity(linear_plasticity, linear_plasticity_threshold, plasticity_type) None

Sets the Linear Plasticity properties

Parameters:
  • linear_plasticity (bool) – Whether it is possible to reset the target angle from the Linear displacement

  • linear_plasticity_threshold (float) – Percent deformation needed to reset the rest length of the joint

  • plasticity_type (ConstraintPlasticityType) –

set_linear_position_drive(enable_drive_x, enable_drive_y, enable_drive_z) None

Enables/Disables linear position drive

Parameters:
  • enable_drive_x (bool) – Indicates whether the drive for the X-Axis should be enabled

  • enable_drive_y (bool) – Indicates whether the drive for the Y-Axis should be enabled

  • enable_drive_z (bool) – Indicates whether the drive for the Z-Axis should be enabled

set_linear_position_target(pos_target) None

Sets the target position for the linear drive.

Parameters:

pos_target (Vector) – Target position

set_linear_velocity_drive(enable_drive_x, enable_drive_y, enable_drive_z) None

Enables/Disables linear position drive

Parameters:
  • enable_drive_x (bool) – Indicates whether the drive for the X-Axis should be enabled

  • enable_drive_y (bool) – Indicates whether the drive for the Y-Axis should be enabled

  • enable_drive_z (bool) – Indicates whether the drive for the Z-Axis should be enabled

set_linear_velocity_target(vel_target) None

Sets the target velocity for the linear drive.

Parameters:

vel_target (Vector) – Target velocity

set_linear_x_limit(constraint_type, limit_size) None

Sets the LinearX Motion Type

Parameters:
set_linear_y_limit(constraint_type, limit_size) None

Sets the LinearY Motion Type

Parameters:
set_linear_z_limit(constraint_type, limit_size) None

Sets the LinearZ Motion Type

Parameters:
set_orientation_drive_slerp(enable_slerp) None

Enables/Disables the angular orientation slerp drive. Only relevant if the AngularDriveMode is set to SLERP

Parameters:

enable_slerp (bool) – Indicates whether the SLERP drive should be enabled. Only relevant if the AngularDriveMode is set to SLERP

set_orientation_drive_twist_and_swing(enable_twist_drive, enable_swing_drive) None

Enables/Disables angular orientation drive. Only relevant if the AngularDriveMode is set to Twist and Swing

Parameters:
  • enable_twist_drive (bool) – Indicates whether the drive for the twist axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing

  • enable_swing_drive (bool) – Indicates whether the drive for the swing axis should be enabled. Only relevant if the AngularDriveMode is set to Twist and Swing