hello, today I’m testing my game and built my game server.
my tank not moving! I’m checked linear velocity by debugging logs. tank velocity is so different when i running server at the unity editor.
I’m using IJobForEach to update PhysicsVelocity. what can I do to get same results like editor?
velocity.x at editor: 8, velocity.x at windows: 0.0001 for example.
tested on havok and unity physic engine.
the code:
private struct UpdateJob : IJobForEach<PhysicsVelocity, Rotation,
ServerTankMovementData>
{
[ReadOnly]
public float DeltaTime;
public void Execute(ref PhysicsVelocity physicsVelocity, ref Rotation rotation,
[ReadOnly] ref ServerTankMovementData tankMovementData)
{
//move
var inputs = new float3
{
x = tankMovementData.MovementInputs,
y = 0,
z = -tankMovementData.TurnInputs
};
physicsVelocity.Linear += inputs * tankMovementData.Speed * DeltaTime;
if (!inputs.Equals(float3.zero))
rotation.Value = Quaternion.LookRotation(inputs);
}
}