Version:

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:

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:

The following components are currently incompatible because they are not yet supported, but do not have fundamental reasons making compatibility difficult to add:

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))