unreal.Transform
¶
- class unreal.Transform(location=[0.0, 0.0, 0.0], rotation=[0.0, 0.0, 0.0], scale=[1.0, 1.0, 1.0])¶
Bases:
unreal.StructBase
Transform composed of Quat/Translation/Scale. note: 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: Rotation of this transformation, as a quaternion.scale3d
(Vector): [Read-Write] Scale 3D: 3D scale (always applied in local space) as a vector.translation
(Vector): [Read-Write] Translation: 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)
- Return type
- interp_to(target, delta_time, interp_speed) Transform ¶
Tries to reach Target transform based on distance from Current position, giving a nice smooth feeling when tracking a position.
- 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
- 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.
- 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.
- 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.
- 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
- Return type
- 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
b (Transform) –
alpha (float) –
interp_mode (LerpInterpolationMode) –
- Return type
- 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.
- 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.
- property rotation¶
[Read-Write] Rotation: Rotation of this transformation, as a quaternion.
- Type
(Quat)
- property scale3d¶
[Read-Write] Scale 3D: 3D scale (always applied in local space) as a vector.
- Type
(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.
- 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.