3 using Unity.Collections;
6 using Unity.Mathematics;
7 using Unity.Transforms;
11 namespace droid.Runtime.EcsPrototyping
13 public class HelloRotationSpeedSystem : JobComponentSystem
17 struct HelloRotationSpeedJob : IJobProcessComponentData<Rotation, HelloRotationSpeed>
20 [ReadOnly]
public float DeltaT;
23 public void Execute(ref Rotation rotation, [ReadOnly] ref HelloRotationSpeed rotSpeed)
27 math.mul(math.normalize(rotation.Value), quaternion.AxisAngle(math.up(), rotSpeed.rotationalMultiplier * this.DeltaT));
32 protected override JobHandle OnUpdate(JobHandle inputDependencies)
34 var job =
new HelloRotationSpeedJob(){
35 DeltaT = Time.deltaTime
38 return job.Schedule(
this, inputDependencies);