unreal.SceneComponent
¶
- class unreal.SceneComponent(outer: Optional[Object] = None, name: Union[Name, str] = 'None')¶
Bases:
ActorComponent
A SceneComponent has a transform and supports attachment, but has no rendering or collision capabilities. Useful as a ‘dummy’ component in the hierarchy to offset others. see: [Scene Components](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Actors/Components/index.html#scenecomponents)
C++ Source:
Module: Engine
File: SceneComponent.h
Editor Properties: (see get_editor_property/set_editor_property)
absolute_location
(bool): [Read-Write] Absolute Location: If RelativeLocation should be considered relative to the world, rather than the parentabsolute_rotation
(bool): [Read-Write] Absolute Rotation: If RelativeRotation should be considered relative to the world, rather than the parentabsolute_scale
(bool): [Read-Write] Absolute Scale: If RelativeScale3D should be considered relative to the world, rather than the parentasset_user_data
(Array[AssetUserData]): [Read-Write] Asset User Data: Array of user data stored with the componentauto_activate
(bool): [Read-Write] Auto Activate: Whether the component is activated at creation or must be explicitly activated.can_ever_affect_navigation
(bool): [Read-Write] Can Ever Affect Navigation: Whether this component can potentially influence navigationcomponent_tags
(Array[Name]): [Read-Write] Component Tags: Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.detail_mode
(DetailMode): [Read-Write] Detail Mode: If detail mode is >= system detail mode, primitive won’t be rendered.editable_when_inherited
(bool): [Read-Write] Editable when Inherited: True if this component can be modified when it was inherited from a parent actor classhidden_in_game
(bool): [Read-Write] Hidden in Game: Whether to hide the primitive in game, if the primitive is Visible.is_editor_only
(bool): [Read-Write] Is Editor Only: If true, the component will be excluded from non-editor buildsmobility
(ComponentMobility): [Read-Write] Mobility: 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] On Component Activated: Called when the component has been activated, with parameter indicating if it was from a reseton_component_deactivated
(ActorComponentDeactivateSignature): [Read-Write] On Component Deactivated: Called when the component has been deactivatedphysics_volume_changed_delegate
(PhysicsVolumeChanged): [Read-Write] Physics Volume Changed Delegate: Delegate that will be called when PhysicsVolume has been changed *primary_component_tick
(ActorComponentTickFunction): [Read-Write] Primary Component Tick: Main tick function for the Componentrelative_location
(Vector): [Read-Write] Relative Location: Location of the component relative to its parentrelative_rotation
(Rotator): [Read-Write] Relative Rotation: Rotation of the component relative to its parentrelative_scale3d
(Vector): [Read-Write] Relative Scale 3D: 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] Replicate Using Registered Sub Object List: 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] Replicates: 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] Should Update Physics Volume: 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] Use Attach Parent Bound: 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] Visible: Whether to completely draw the primitive; if false, the primitive is not drawn, does not cast a shadow.
- property absolute_location: bool¶
[Read-Write] Absolute Location: If RelativeLocation should be considered relative to the world, rather than the parent
- Type:
(bool)
- property absolute_rotation: bool¶
[Read-Write] Absolute Rotation: If RelativeRotation should be considered relative to the world, rather than the parent
- Type:
(bool)
- property absolute_scale: bool¶
[Read-Write] Absolute Scale: If RelativeScale3D should be considered relative to the world, rather than the parent
- Type:
(bool)
- add_local_offset(delta_location, sweep, teleport) HitResult ¶
Adds a delta to the location of the component in its local reference frame
- Parameters:
delta_location (Vector) – Change in location of the component in its local reference frame.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_local_rotation(delta_rotation, sweep, teleport) HitResult ¶
Adds a delta to the rotation of the component in its local reference frame
- Parameters:
delta_rotation (Rotator) – Change in rotation of the component in its local reference frame.
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation).
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_local_transform(delta_transform, sweep, teleport) HitResult ¶
Adds a delta to the transform of the component in its local reference frame. Scale is unchanged.
- Parameters:
delta_transform (Transform) – Change in transform of the component in its local reference frame. Scale is unchanged.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_relative_location(delta_location, sweep, teleport) HitResult ¶
Adds a delta to the translation of the component relative to its parent
- Parameters:
delta_location (Vector) – Change in location of the component relative to its parent
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_relative_rotation(delta_rotation, sweep, teleport) HitResult ¶
Adds a delta the rotation of the component relative to its parent
- Parameters:
delta_rotation (Rotator) – Change in rotation of the component relative to is parent.
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation).
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_world_offset(delta_location, sweep, teleport) HitResult ¶
Adds a delta to the location of the component in world space.
- Parameters:
delta_location (Vector) – Change in location in world space for the component.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_world_rotation(delta_rotation, sweep, teleport) HitResult ¶
Adds a delta to the rotation of the component in world space.
- Parameters:
delta_rotation (Rotator) – Change in rotation in world space for the component.
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation).
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_world_transform(delta_transform, sweep, teleport) HitResult ¶
Adds a delta to the transform of the component in world space. Ignores scale and sets it to (1,1,1).
- Parameters:
delta_transform (Transform) – Change in transform in world space for the component. Scale is ignored.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- add_world_transform_keep_scale(delta_transform, sweep, teleport) HitResult ¶
Adds a delta to the transform of the component in world space. Scale is unchanged.
- Parameters:
delta_transform (Transform) – Change in transform in world space for the component. Scale is ignored since we preserve the original scale.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- attach_to(parent: SceneComponent, socket_name: Name = 'None', attach_type: AttachLocation = Ellipsis, weld_simulated_bodies: bool = True) bool ¶
deprecated: ‘attach_to’ was renamed to ‘k2_attach_to’.
- attach_to_component(parent, socket_name, location_rule, rotation_rule, scale_rule, weld_simulated_bodies=True) bool ¶
Attach this component to another scene component, optionally at a named socket. It is valid to call this on components whether or not they have been Registered.
- Parameters:
parent (SceneComponent) – Parent to attach to.
socket_name (Name) – Optional socket to attach to on the parent.
location_rule (AttachmentRule) – How to handle translation when attaching.
rotation_rule (AttachmentRule) – How to handle rotation when attaching.
scale_rule (AttachmentRule) – How to handle scale when attaching.
weld_simulated_bodies (bool) – Whether to weld together simulated physics bodies.
- Returns:
True if attachment is successful (or already attached to requested parent/socket), false if attachment is rejected and there is no change in AttachParent.
- Return type:
- property b_absolute_translation: bool¶
‘b_absolute_translation’ was renamed to ‘absolute_location’.
- Type:
deprecated
- detach_from_component(location_rule=DetachmentRule.KEEP_RELATIVE, rotation_rule=DetachmentRule.KEEP_RELATIVE, scale_rule=DetachmentRule.KEEP_RELATIVE, call_modify=True) None ¶
Detach this component from whatever it is attached to. Automatically unwelds components that are welded together (See WeldTo)
- Parameters:
location_rule (DetachmentRule) – How to handle translations when detaching.
rotation_rule (DetachmentRule) – How to handle rotation when detaching.
scale_rule (DetachmentRule) – How to handle scales when detaching.
call_modify (bool) – If true, call Modify() on the component and the current attach parent component
- property detail_mode: DetailMode¶
[Read-Only] Detail Mode: If detail mode is >= system detail mode, primitive won’t be rendered.
- Type:
- get_attach_parent() SceneComponent ¶
Get the SceneComponent we are attached to.
- Return type:
- get_child_component(child_index) SceneComponent ¶
Gets the attached child component at the specified location
- Parameters:
child_index (int32) –
- Return type:
- get_children_components(include_all_descendants) Array[SceneComponent] ¶
Gets all components that are attached to this component, possibly recursively
- Parameters:
include_all_descendants (bool) – Whether to include all descendants in the list of children (i.e. grandchildren, great grandchildren, etc.)
- Returns:
children (Array[SceneComponent]): The list of attached child components
- Return type:
- get_component_velocity() Vector ¶
Get velocity of the component: either ComponentVelocity, or the velocity of the physics body if simulating physics.
- Returns:
Velocity of the component
- Return type:
- get_forward_vector() Vector ¶
Get the forward (X) unit direction vector from this component, in world space.
- Return type:
- get_num_children_components() int32 ¶
Gets the number of attached children components
- Return type:
int32
- get_parent_components() Array[SceneComponent] ¶
Gets all attachment parent components up to and including the root component
- Returns:
parents (Array[SceneComponent]):
- Return type:
- get_physics_volume() PhysicsVolume ¶
Get the PhysicsVolume overlapping this component.
- Return type:
- get_relative_transform() Transform ¶
Returns the transform of the component relative to its parent
- Return type:
- get_right_vector() Vector ¶
Get the right (Y) unit direction vector from this component, in world space.
- Return type:
- get_socket_quaternion(socket_name) Quat ¶
Get world-space socket or bone FQuat rotation. deprecated: Use GetSocketRotation instead, Quat is not fully supported in blueprints.
- get_socket_transform(socket_name, transform_space=RelativeTransformSpace.RTS_WORLD) Transform ¶
Get world-space socket transform.
- Parameters:
socket_name (Name) – Name of the socket or the bone to get the transform
transform_space (RelativeTransformSpace) –
- Returns:
Socket transform in world space if socket if found. Otherwise it will return component’s transform in world space.
- Return type:
- get_up_vector() Vector ¶
Get the up (Z) unit direction vector from this component, in world space.
- Return type:
- get_world_transform() Transform ¶
Get the current component-to-world transform for this component
- Return type:
[Read-Only] Hidden in Game: Whether to hide the primitive in game, if the primitive is Visible.
- Type:
(bool)
- is_any_simulating_physics() bool ¶
Returns whether the specified body is currently using physics simulation
- Return type:
- is_simulating_physics(bone_name='None') bool ¶
Returns whether the specified body is currently using physics simulation
- k2_attach_to(parent, socket_name='None', attach_type=AttachLocation.KEEP_RELATIVE_OFFSET, weld_simulated_bodies=True) bool ¶
K2 Attach To
- Parameters:
parent (SceneComponent) –
socket_name (Name) –
attach_type (AttachLocation) –
weld_simulated_bodies (bool) –
- Return type:
- property mobility: ComponentMobility¶
[Read-Only] Mobility: How often this component is allowed to move, used to make various optimizations. Only safe to set in constructor.
- Type:
- property modify_frequency: ComponentMobility¶
‘modify_frequency’ was renamed to ‘mobility’.
- Type:
deprecated
- property physics_volume_changed_delegate: PhysicsVolumeChanged¶
[Read-Write] Physics Volume Changed Delegate: Delegate that will be called when PhysicsVolume has been changed *
- Type:
- property relative_location: Vector¶
[Read-Only] Relative Location: Location of the component relative to its parent
- Type:
(Vector)
- property relative_rotation: Rotator¶
[Read-Only] Relative Rotation: Rotation of the component relative to its parent
- Type:
(Rotator)
- property relative_scale3d: Vector¶
[Read-Only] Relative Scale 3D: Non-uniform scaling of the component relative to its parent. Note that scaling is always applied in local space (no shearing etc)
- Type:
(Vector)
- property relative_translation: Vector¶
‘relative_translation’ was renamed to ‘relative_location’.
- Type:
deprecated
- reset_relative_transform() None ¶
Reset the transform of the component relative to its parent. Sets relative location to zero, relative rotation to no rotation, and Scale to 1.
- set_absolute(new_absolute_location=False, new_absolute_rotation=False, new_absolute_scale=False) None ¶
Set which parts of the relative transform should be relative to parent, and which should be relative to world
Changes the value of bHiddenInGame, if false this will disable Visibility during gameplay
- set_mobility(new_mobility) None ¶
Set how often this component is allowed to move during runtime. Causes a component re-register if the component is already registered
- Parameters:
new_mobility (ComponentMobility) –
- set_relative_location(new_location, sweep, teleport) HitResult ¶
Set the location of the component relative to its parent
- Parameters:
new_location (Vector) – New location of the component relative to its parent.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_relative_location_and_rotation(new_location, new_rotation, sweep, teleport) HitResult ¶
Set the location and rotation of the component relative to its parent
- Parameters:
new_location (Vector) – New location of the component relative to its parent.
new_rotation (Rotator) – New rotation of the component relative to its parent.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_relative_rotation(new_rotation, sweep, teleport) HitResult ¶
Set the rotation of the component relative to its parent
- Parameters:
new_rotation (Rotator) – New rotation of the component relative to its parent
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation).
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_relative_scale3d(new_scale3d) None ¶
Set the non-uniform scale of the component relative to its parent
- Parameters:
new_scale3d (Vector) –
- set_relative_transform(new_transform, sweep, teleport) HitResult ¶
Set the transform of the component relative to its parent
- Parameters:
new_transform (Transform) – New transform of the component relative to its parent.
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation).
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_visibility(new_visibility, propagate_to_children=False) None ¶
Set visibility of the component, if during game use this to turn on/off
- set_world_location(new_location, sweep, teleport) HitResult ¶
Put this component at the specified location in world space. Updates relative location to achieve the final world location.
- Parameters:
new_location (Vector) – New location in world space for the component.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_world_location_and_rotation(new_location, new_rotation, sweep, teleport) HitResult ¶
Set the relative location and rotation of the component to put it at the supplied pose in world space.
- Parameters:
new_location (Vector) – New location in world space for the component.
new_rotation (Rotator) – New rotation in world space for the component.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- set_world_rotation(new_rotation, sweep, teleport) HitResult ¶
Put this component at the specified rotation in world space. Updates relative rotation to achieve the final world rotation.
- Parameters:
new_rotation (Rotator) – New rotation in world space for the component. *
sweep (bool) – Whether we sweep to the destination (currently not supported for rotation). *
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). * If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). * If false, physics velocity is updated based on the change in position (affecting ragdoll parts). * If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true. *
- Return type:
- set_world_scale3d(new_scale) None ¶
Set the relative scale of the component to put it at the supplied scale in world space.
- Parameters:
new_scale (Vector) – New scale in world space for this component.
- set_world_transform(new_transform, sweep, teleport) HitResult ¶
Set the transform of the component in world space.
- Parameters:
new_transform (Transform) – New transform in world space for the component.
sweep (bool) – Whether we sweep to the destination location, triggering overlaps along the way and stopping short of the target if blocked by something. Only the root component is swept and checked for blocking collision, child components move without sweeping. If collision is off, this has no effect.
teleport (bool) – Whether we teleport the physics state (if physics collision is enabled for this object). If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location). If false, physics velocity is updated based on the change in position (affecting ragdoll parts). If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
- Returns:
sweep_hit_result (HitResult): Hit result from any impact if sweep is true.
- Return type:
- property should_update_physics_volume: bool¶
[Read-Write] Should Update Physics Volume: Whether or not the cached PhysicsVolume this component overlaps should be updated when the component is moved. see: GetPhysicsVolume()
- Type:
(bool)
- toggle_visibility(propagate_to_children=False) None ¶
Toggle visibility of the component
- Parameters:
propagate_to_children (bool) –