Skip to content

Commit ce6b25a

Browse files
Added transform shorthands
1 parent 079c282 commit ce6b25a

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Runtime/EntityComponent.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,53 @@ public abstract class EntityComponent<EntityComponentType, EntitySystemType> : U
2424
/// </summary>
2525
public bool isEnabled { get; private set; } = false;
2626

27+
/// <summary>
28+
/// Shorthand for the entity's transform position.
29+
/// </summary>
30+
public Vector3 position {
31+
get => transform.position;
32+
set => transform.position = value;
33+
}
34+
35+
/// <summary>
36+
/// Shorthand for the entity's transform local position.
37+
/// </summary>
38+
public Vector3 localPosition {
39+
get => transform.localPosition;
40+
set => transform.localPosition = value;
41+
}
42+
43+
/// <summary>
44+
/// Shorthand for the entity's transform rotation.
45+
/// </summary>
46+
public Quaternion rotation {
47+
get => transform.rotation;
48+
set => transform.rotation = value;
49+
}
50+
51+
/// <summary>
52+
/// Shorthand for the entity's transform local rotation.
53+
/// </summary>
54+
public Quaternion localRotation {
55+
get => transform.localRotation;
56+
set => transform.localRotation = value;
57+
}
58+
59+
/// <summary>
60+
/// Shorthand for the entity's transform lossy scale.
61+
/// </summary>
62+
public Vector3 lossyScale {
63+
get => transform.lossyScale;
64+
}
65+
66+
/// <summary>
67+
/// Shorthand for the entity's transform local scale.
68+
/// </summary>
69+
public Vector3 localScale {
70+
get => transform.localScale;
71+
set => transform.localScale = value;
72+
}
73+
2774
/// <summary>
2875
/// Gets the system matched with this entity's component. If it's not
2976
/// defined, it will be fetched from the controller.

0 commit comments

Comments
 (0)