convertScaleTo

@MainThread
fun convertScaleTo(scale: Vector3, targetEntity: Entity?): Vector3

Converts a scale relative to the current entity to a targetEntity.

Attention: "relative to" an Entity is different from "in the local coordinate system/space of" the Entity. You may use the converted result to place an entity when you need a scale in that entity's local coordinate space. In this case, the proper targetEntity should be the parent of the entity to place. For example, if entityA and entityB are in different coordinate spaces, and scaleA is relative to entityA, pass entityB's parent as targetEntity when placing entityB with scaleA.

entityB.components.get<TransformComponent>()?.scale = entityA.convertScaleTo(scaleA,
entityB.getParent())

Return

The converted scale relative to targetEntity, or relative to the current entity's SpatialContainer when targetEntity is null.

Parameters

scale

The scale relative to the current entity.

targetEntity

The target entity to which the scale will be converted. If null, the scale is converted relative to the SpatialContainer where the current entity is placed.