ParentRotationChangesRotation
Last updated
Was this helpful?
Last updated
Was this helpful?
The ParentRotationChangesRotation property tells an object whether its rotation should be relative to its parent rotation. This is true by default but it can be set to false.
This code could be used to tell a health bar to not rotate when whatever it is attached to rotates:
Attachments create a relationship in which the child is both positioned and rotated relative to the parent. In some cases it is useful to suppress some of this behavior.
The ParentRotationChangesRotation property controls whether the rotation of a child is modified by the parents' rotation. In the following example the ship (represented by the red ball) rotates and moves according to input from the keyboard. The is attached to the but does not rotate with it.
Declare the ship at class scope:
In Initialize:
In Update:
Notice that although the is attached to the ship , it does not rotate. Try setting the ParentRotationChangesRotation property to true and observe the behavior.