IN THIS ARTICLE
Non-uniform Scale Component
The Non-uniform Scale component allows entities to be scaled by different amounts along each local axis. It can be added by clicking the Add non-uniform scale button on the Transform component.
The Non-uniform Scale component is incompatible with certain other components which cannot be non-uniformly scaled without fundamentally changing their character. For example, it is incompatible with Sphere Shape component because non-uniformly scaling a sphere would result in an ellipsoid and break the characteristic symmetry of the sphere.
To avoid problems with skew, non-uniform scale is only applied to the current entity and does not propagate to its children.
Compatible components
The following components are compatible with Non-uniform Scale:
- Box Shape
- Polygon Prism Shape
- Quad Shape
- PhysX Primitive Collider - Note that primitive colliders are replaced with convex approximations if they are non-uniformly scaled, which may slightly deteriorate performance. The level of detail of the convex approximation can be adjusted using the Subdivision level setting on the PhysX Primitive Collider component.
- PhysX Mesh Collider
- PhysX Shape Collider
- PhysX Static Rigid Body
- PhysX Dynamic Rigid Body
- PhysX Force Region
- Decal
- Mesh
Incompatible components
The following components are incompatible with the Non-uniform Scale component because non-uniform scaling would break fundamental assumptions made by the components or because they would require major work to properly support non-uniform scale:
- Capsule Shape
- Compound Shape
- Cylinder Shape
- Disk Shape
- Sphere Shape
- Tube Shape
- Cloth
- PhysX Ball Joint
- PhysX Fixed Joint
- PhysX Hinge Joint
- PhysX Prismatic Joint
- PhysX Ragdoll
- PhysX Character Controller
- PhysX Character Gameplay
- Attachment
- Actor
- Simple Motion
- Fly Camera Input
- HDRi Skybox
- Physical Sky
The following components are currently incompatible because they are not yet supported, but do not have fundamental reasons making compatibility difficult to add:
- Sequence
- Spline
- White Box
- White Box Collider
- Diffuse Probe Grid
- Reflection Probe
EBus Request Bus Interface
NonUniformScaleRequestBus is the request bus for the Non-uniform Scale component.
For more information about using the event bus (EBus) interface, see Working with the Event Bus (EBus) system.
Use the following request functions with the EBus interface to communicate with other components.
GetScale
Returns the entity’s non-uniform scale.
Parameters None
Return Entity’s non-uniform scale value. Type: Vector3
SetScale
Sets the entity’s non-uniform scale.
Parameters New non-uniform scale value. Type: Vector3
Return None
RegisterScaleChangedEvent
Registers a handler for the AZ::Event raised when the entity’s non-uniform scale is changed.
Parameters Handler for non-uniform scale change events. Type: NonUniformScaleChangedEvent::Handler
Return None
Editor Automation
The component type id for the editor Non-uniform Scale component can be accessed for editor automation using the following.
azlmbr.editor.EditorNonUniformScaleComponentTypeId
For example, a Non-uniform Scale component can be added and the scale modified as follows.
nonUniformScaleComponentId = azlmbr.editor.EditorNonUniformScaleComponentTypeId
azlmbr.editor.EditorComponentAPIBus(azlmbr.bus.Broadcast,'AddComponentsOfType', entityId, [nonUniformScaleComponentId])
azlmbr.entity.NonUniformScaleRequestBus(azlmbr.bus.Event, 'SetScale', entityId, azlmbr.math.Vector3(1.0, 2.0, 3.0))