Documentation: InheritTransformComponent
Jump to navigation
Jump to search
Name | Type | Initial Value | Example Range | Description |
---|---|---|---|---|
Members | ||||
use_root_parent | bool | false | if 1, we use the root of our entity hierarchy instead of the immediate parent | |
only_position | bool | false | if 1, we only inherit position. it is calculated as follows: parent_position + parent_offset * parent_scale | |
parent_hotspot_tag | std::string | if set, we apply the offset of parent HotSpot with this tag | ||
parent_sprite_id | int | -1 | if >= 0, the Nth sprite transform in parent entity is inherited | |
always_use_immediate_parent_rotation | bool | false | if 1, we use the immediate parent for rotation, no matter what other properties say | |
rotate_based_on_x_scale | bool | false | if 1, the rotation is set to 0 deg if scale >= 0 else to 180 deg | |
Custom data types | ||||
Transform | types::xform | |||
Privates | ||||
mUpdateFrame | int | -1 |
Usage
The Transform
field is set like this in entity .xml files.
<InheritTransformComponent>
<Transform
position.x="8"
position.y="0"
rotation="0"
scale.x="1"
scale.y="1" >
</Transform>
</InheritTransformComponent>
You can also get/change the transform field from Lua like this:
local x, y, scale_x, scale_y, rot = ComponentGetValue2(inherit_trans_comp, "Transform")
x = x + 1
y = -y
ComponentSetValue2(inherit_trans_comp, "Transform", x, y, scale_x, scale_y, rot)