unreal.Transform

class unreal.Transform(location=[0.0, 0.0, 0.0], rotation=[0.0, 0.0, 0.0], scale=[0.0, 0.0, 0.0])

Bases: unreal.StructBase

Transform composed of Quat/Translation/Scale. This is implemented in either TransformVectorized.h or TransformNonVectorized.h depending on the platform.:

C++ Source:

  • Module: CoreUObject
  • File: NoExportTypes.h

Editor Properties: (see get_editor_property/set_editor_property)

  • rotation (Quat): [Read-Write] Rotation of this transformation, as a quaternion.
  • scale3d (Vector): [Read-Write] 3D scale (always applied in local space) as a vector.
  • translation (Vector): [Read-Write] Translation of this transformation, as a vector.
__eq__(other)

Overloads:

  • Transform Returns true if transform A is equal to transform B
__imul__(other)

Overloads:

  • Transform Compose two transforms in order: A * B.

    Order matters when composing transforms: A * B will yield a transform that logically first applies A then B to any subsequent transformation.

    Example: LocalToWorld = ComposeTransforms(DeltaRotation, LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = ComposeTransforms(LocalToWorld, DeltaRotation) will change rotation in world space by DeltaRotation.

    @return New transform: A * B

__mul__(other)

Overloads:

  • Transform Compose two transforms in order: A * B.

    Order matters when composing transforms: A * B will yield a transform that logically first applies A then B to any subsequent transformation.

    Example: LocalToWorld = ComposeTransforms(DeltaRotation, LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = ComposeTransforms(LocalToWorld, DeltaRotation) will change rotation in world space by DeltaRotation.

    @return New transform: A * B

determinant() → float

Calculates the determinant of the transform (converts to FMatrix internally)

Returns:
Return type:float
equals(b) → bool

Returns true if transform A is equal to transform B

Parameters:b (Transform) –
Returns:
Return type:bool
interp_to(target, delta_time, interp_speed) → Transform

Tries to reach a target transform.

Parameters:
Returns:

Return type:

Transform

inverse() → Transform

Returns the inverse of the given transform T.

Example: Given a LocalToWorld transform, WorldToLocal will be returned.

Returns:The inverse of T.
Return type:Transform
inverse_transform_direction(direction) → Vector

Transform a direction vector by the inverse of the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from world space to local space.

Parameters:direction (Vector) –
Returns:
Return type:Vector
inverse_transform_location(location) → Vector

Transform a position by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a position from world space to local space.

Parameters:location (Vector) –
Returns:
Return type:Vector
inverse_transform_rotation(rotation) → Rotator

Transform a rotator by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a rotation from world space to local space.

Parameters:rotation (Rotator) –
Returns:
Return type:Rotator
is_near_equal(b, location_tolerance=0.000100, rotation_tolerance=0.000100, scale3d_tolerance=0.000100) → bool

Returns true if transform A is nearly equal to B

Parameters:
  • b (Transform) –
  • location_tolerance (float) – How close position of transforms need to be to be considered equal
  • rotation_tolerance (float) – How close rotations of transforms need to be to be considered equal
  • scale3d_tolerance (float) – How close scale of transforms need to be to be considered equal
Returns:

Return type:

bool

lerp(b, alpha, interp_mode=LerpInterpolationMode.QUAT_INTERP) → Transform

Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1).

Parameters:
Returns:

Return type:

Transform

make_relative(relative_to) → Transform

Computes a relative transform of one transform compared to another.

Example: ChildOffset = MakeRelativeTransform(Child.GetActorTransform(), Parent.GetActorTransform()) This computes the relative transform of the Child from the Parent.

Parameters:relative_to (Transform) – The transform the result is relative to (in the same space as A)
Returns:The new relative transform
Return type:Transform
multiply(b) → Transform

Compose two transforms in order: A * B.

Order matters when composing transforms: A * B will yield a transform that logically first applies A then B to any subsequent transformation.

Example: LocalToWorld = ComposeTransforms(DeltaRotation, LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = ComposeTransforms(LocalToWorld, DeltaRotation) will change rotation in world space by DeltaRotation.

Parameters:b (Transform) –
Returns:New transform: A * B
Return type:Transform
rotation

(Quat) – [Read-Write] Rotation of this transformation, as a quaternion.

scale3d

(Vector) – [Read-Write] 3D scale (always applied in local space) as a vector.

transform_direction(direction) → Vector

Transform a direction vector by the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from local space to world space.

Parameters:direction (Vector) –
Returns:
Return type:Vector
transform_location(location) → Vector

Transform a position by the supplied transform. For example, if T was an object’s transform, this would transform a position from local space to world space.

Parameters:location (Vector) –
Returns:
Return type:Vector
transform_rotation(rotation) → Rotator

Transform a rotator by the supplied transform. For example, if T was an object’s transform, this would transform a rotation from local space to world space.

Parameters:rotation (Rotator) –
Returns:
Return type:Rotator
translation

(Vector) – [Read-Write] Translation of this transformation, as a vector.