Hi i have been trying out netcode for entities recently and i just cant get this working. On low delay it does what i expect. But on higher delays its like it teleporting. I have been trying to get the prediction to work for a while now and I just cant figure it out...
[UpdateInGroup(typeof(PredictedSimulationSystemGroup))]
partial struct NetcodePlayerMoverSystem : ISystem {
[BurstCompile]
public void OnCreate(ref SystemState state) {
state.RequireForUpdate<NetworkStreamInGame>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state) {
NetworkTime networkTime = SystemAPI.GetSingleton<NetworkTime>();
if (networkTime.IsFirstTimeFullyPredictingTick) {
MoveVrPlayerRigsJob moveVrPlayerRigsJob = new MoveVrPlayerRigsJob {
deltaTime = SystemAPI.Time.DeltaTime
};
state.Dependency = moveVrPlayerRigsJob.ScheduleParallel(state.Dependency);
}
}
}
[BurstCompile]
[WithAll(typeof(Simulate))]
[WithAll(typeof(GhostOwnerIsLocal))]
internal partial struct MoveVrPlayerRigsJob : IJobEntity {
public float deltaTime;
public void Execute(ref VrInput vrInput, ref PhysicsVelocity physicsVelocity, ref PhysicsMass physicsMass) {
physicsMass.InverseInertia = new float3(0f, physicsMass.InverseInertia.y, 0f);
if (vrInput.lift.IsSet){
UnityEngine.Debug.Log("It is set");
float3 jumpForce = new float3(0, 5, 0);
physicsVelocity.Linear = jumpForce;
}
}
}