System.Collections.Generic.Dictionary.ContainsKey(WheelCollider)

Here are the examples of the csharp api System.Collections.Generic.Dictionary.ContainsKey(WheelCollider) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : PhysicsTank.cs
with MIT License
from brihernandez

private void RunPoweredWheels()
   {
      foreach (WheelCollider wheel in poweredWheels)
      {
         // To create a top speed for the tank, the motor torque just
         // cuts out when the tank starts moving fast enough.
         if (rigid.velocity.magnitude <= topSpeed)
            wheel.motorTorque = forwardInput * motorTorque;
         else
            wheel.motorTorque = 0.0f;

         // Update wheel mesh positions to match the physics wheels.
         if (wheelModelPrefab != null && WheelToTransformMap.ContainsKey(wheel))
         {
            Vector3 position;
            Quaternion rotation;
            wheel.GetWorldPose(out position, out rotation);
            WheelToTransformMap[wheel].position = position;
            WheelToTransformMap[wheel].rotation = rotation;
         }
      }
   }

19 Source : PhysicsTank.cs
with MIT License
from brihernandez

private void InstantiateWheelModelsFromPrefab(WheelCollider[] wheels)
   {
      foreach (WheelCollider wheel in wheels)
      {
         // Don't double instantiate wheels. Check to make sure that this wheel doesn't already
         // have a model before instantiating one.
         if (WheelToTransformMap.ContainsKey(wheel) == false)
         {
            Transform temp = Instantiate(wheelModelPrefab, wheel.transform, false);
            
            // Scale the model prefab to match the radius. (replacedumes prefab has diameter of 1m.)
            temp.localScale = Vector3.one * wheel.radius * 2.0f;
            WheelToTransformMap.Add(wheel, temp);
         }
      }
   }