示例#1
0
    private void ResetVehicle()
    {
        CarController  carController   = GetComponent <CarController>();
        Rigidbody      body            = GetComponent <Rigidbody>();
        TransformState historicalState = SampleHistoryState();

        carController.ApplyAction(0f, 0f);
        transform.position   = historicalState.position;
        transform.rotation   = historicalState.rotation;
        body.velocity        = Vector3.zero;
        body.angularVelocity = Vector3.zero;
        carController.ApplyAction(1f, 0f);
    }
示例#2
0
    private void ResetVehicle()
    {
        CarController  carController   = GetComponent <CarController>();
        Rigidbody      body            = GetComponent <Rigidbody>();
        TransformState historicalState = /*ResetFromLastCheckpoint();*/ SampleHistoryState();

        Debug.Log("checkpointNumber " + checkpointsPassed);

        //historicalState.rotation *= Quaternion.Euler(Vector3.up * (-180));

        carController.ApplyAction(0f, 0f);
        transform.position   = historicalState.position;
        transform.rotation   = historicalState.rotation;
        body.velocity        = Vector3.zero;
        body.angularVelocity = Vector3.zero;
        carController.ApplyAction(1f, 0f);
    }
 private void ApplyAction(int vertical, int horizontal)
 {
     carController.ApplyAction(vertical, horizontal);
 }