4 using Unity.Collections;
7 using Unity.Mathematics;
8 using Unity.Transforms;
12 namespace droid.Runtime.EcsPrototyping.Systems
14 public class HelloRotationSpeedSystem : JobComponentSystem
18 struct HelloRotationSpeedJob : IJobProcessComponentData<Rotation, HelloRotationSpeed>
21 [ReadOnly]
public float DeltaT;
24 public void Execute(ref Rotation rotation, [ReadOnly] ref HelloRotationSpeed rotSpeed)
28 math.mul(math.normalize(rotation.Value), quaternion.AxisAngle(math.up(), rotSpeed.rotationalMultiplier * this.DeltaT));
33 protected override JobHandle OnUpdate(JobHandle inputDependencies)
35 var job =
new HelloRotationSpeedJob(){
36 DeltaT = Time.deltaTime
39 return job.Schedule(
this, inputDependencies);