| | 1 | | using DCL.Controllers; |
| | 2 | | using DCL.ECSComponents; |
| | 3 | | using DCL.Models; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace ECSSystems.Helpers |
| | 7 | | { |
| | 8 | | public static class TransformHelper |
| | 9 | | { |
| 1 | 10 | | private static readonly ECSTransform reusableTransform = new ECSTransform() |
| | 11 | | { |
| | 12 | | position = Vector3.zero, |
| | 13 | | scale = Vector3.one, |
| | 14 | | parentId = SpecialEntityId.SCENE_ROOT_ENTITY, |
| | 15 | | rotation = Quaternion.identity |
| | 16 | | }; |
| | 17 | |
|
| | 18 | | public static ECSTransform SetTransform(IParcelScene scene, ref Vector3 position, |
| | 19 | | ref Quaternion rotation, ref Vector3 worldOffset) |
| | 20 | | { |
| 8 | 21 | | Vector3Helper.SetInSceneOffset(ref reusableTransform.position, scene, ref position, ref worldOffset); |
| 8 | 22 | | QuaternionHelper.Set(ref reusableTransform.rotation, ref rotation); |
| | 23 | |
|
| 8 | 24 | | return reusableTransform; |
| | 25 | | } |
| | 26 | | } |
| | 27 | | } |