UnityEngine.Physics.CapsuleCast(UnityEngine.Vector3, UnityEngine.Vector3, float, UnityEngine.Vector3, out UnityEngine.RaycastHit, float, int)

Here are the examples of the csharp api UnityEngine.Physics.CapsuleCast(UnityEngine.Vector3, UnityEngine.Vector3, float, UnityEngine.Vector3, out UnityEngine.RaycastHit, float, int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : LocomotionTeleport.cs
License : MIT License
Project Creator : Tobbse

public bool AimCollisionTest(Vector3 start, Vector3 end, LayerMask aimCollisionLayerMask, out RaycastHit hitInfo)
	{
		var delta = end - start;
		var distance = delta.magnitude;
		var direction = delta / distance;

		switch (AimCollisionType)
		{
			case AimCollisionTypes.Capsule:
			{
				float r, h;
				if (UseCharacterCollisionData)
				{
					var c = LocomotionController.CharacterController;
					h = c.height;
					r = c.radius;
				}
				else
				{
					h = AimCollisionHeight;
					r = AimCollisionRadius;
				}
				return Physics.CapsuleCast(start + new Vector3(0, r, 0),
					start + new Vector3(0, h + r, 0), r, direction,
					out hitInfo, distance, aimCollisionLayerMask, QueryTriggerInteraction.Ignore);
			}

			case AimCollisionTypes.Point:
				return Physics.Raycast(start, direction, out hitInfo, distance, aimCollisionLayerMask,QueryTriggerInteraction.Ignore);

			case AimCollisionTypes.Sphere:
			{
				float r;
				if (UseCharacterCollisionData)
				{
					var c = LocomotionController.CharacterController;
					r = c.radius - c.skinWidth;
				}
				else
				{
					r = AimCollisionRadius;
				}
				return Physics.SphereCast(start, r, direction, out hitInfo, distance, aimCollisionLayerMask,
					QueryTriggerInteraction.Ignore);
			}
		}

		// App should never get here.
		throw new Exception();
	}