Version: 2023.2
언어: 한국어

WheelCollider

class in UnityEngine

/

다음으로부터 상속:Collider

매뉴얼로 전환

설명

A special collider for vehicle wheels.

Wheel collider is used to model vehicle wheels. It simulates a spring and damper suspension setup, and uses a slip based tire friction model to calculate wheel contact forces.

Wheel's collision detection is performed by casting a ray from center downwards the local y-axis. The wheel has a radius and can extend downwards by suspensionDistance amount.

The wheel is controlled with motorTorque, brakeTorque and steerAngle properties.

Wheel collider computes friction separately from the rest of physics engine, using a slip based friction model. This allows for more realistic behaviour, but makes wheel colliders ignore standard PhysicMaterial settings. Simulation of different road materials is done by changing the forwardFriction and sidewaysFriction based on what material the wheel is hitting. Additional resources: GetGroundHit and WheelFrictionCurve.

변수

brakeTorqueBrake torque expressed in Newton metres.
centerThe center of the wheel, measured in the object's local space.
forceAppPointDistanceApplication point of the suspension and tire forces measured from the base of the resting wheel.
forwardFrictionProperties of tire friction in the direction the wheel is pointing in.
isGroundedIndicates whether the wheel currently collides with something (Read Only).
massThe mass of the wheel, expressed in kilograms. Must be larger than zero. Typical values would be in range (20,80).
motorTorqueMotor torque on the wheel axle expressed in Newton metres. Positive or negative depending on direction.
radiusThe radius of the wheel, measured in local space.
rotationSpeedRotation speed of the wheel, measured in degrees per second.
rpmCurrent wheel axle rotation speed, in rotations per minute (Read Only).
sidewaysFrictionProperties of tire friction in the sideways direction.
sprungMassThe mass supported by this WheelCollider.
steerAngleSteering angle in degrees, always around the local y-axis.
suspensionDistanceMaximum extension distance of wheel suspension, measured in local space.
suspensionExpansionLimitedLimits the expansion velocity of the Wheel Collider's suspension. If you set this property on a Rigidbody that has several Wheel Colliders, such as a vehicle, then it affects all other Wheel Colliders on the Rigidbody.
suspensionSpringThe parameters of wheel's suspension. The suspension attempts to reach a target position by applying a linear force and a damping force.
wheelDampingRateThe damping rate of the wheel. Must be larger than zero.

Public 함수

ConfigureVehicleSubstepsConfigure vehicle sub-stepping parameters.
GetGroundHitGets ground collision data for the wheel.
GetWorldPoseGets the world space pose of the wheel accounting for ground contact, suspension limits, steer angle, and rotation angle (angles in degrees).
ResetSprungMassesReset the sprung masses of the vehicle.

상속된 멤버

변수

attachedArticulationBodyThe articulation body the collider is attached to.
attachedRigidbodyThe rigidbody the collider is attached to.
boundsThe world space bounding volume of the collider (Read Only).
contactOffsetContact offset value of this collider.
enabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
excludeLayersThe additional layers that this Collider should exclude when deciding if the Collider can contact another Collider.
GeometryHolderThe structure holding the geometric shape of the collider and its type. (Read Only)
hasModifiableContactsSpecify whether this Collider's contacts are modifiable or not.
includeLayersThe additional layers that this Collider should include when deciding if the Collider can contact another Collider.
isTriggerSpecify if this collider is configured as a trigger.
layerOverridePriorityA decision priority assigned to this Collider used when there is a conflicting decision on whether a Collider can contact another Collider.
materialThe material used by the collider.
providesContactsWhether or not this Collider generates contacts for Physics.ContactEvent.
sharedMaterialThe shared physic material of this collider.
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public 함수

ClosestPointReturns a point on the collider that is closest to a given location.
ClosestPointOnBoundsThe closest point to the bounding box of the attached collider.
GetGeometryReturns the geometric shape of the collider of the requested type.
RaycastCasts a Ray that ignores all Colliders except this one.
BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagChecks the GameObject's tag against the defined tag.
GetComponentGets a reference to a component of type T on the same GameObject as the component specified.
GetComponentInChildrenGets a reference to a component of type T on the same GameObject as the component specified, or any child of the GameObject.
GetComponentInParentGets a reference to a component of type T on the same GameObject as the component specified, or any parent of the GameObject.
GetComponentsGets references to all components of type T on the same GameObject as the component specified.
GetComponentsInChildrenGets references to all components of type T on the same GameObject as the component specified, and any child of the GameObject.
GetComponentsInParentGets references to all components of type T on the same GameObject as the component specified, and any parent of the GameObject.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
TryGetComponentGets the component of the specified type, if it exists.
GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

정적 함수

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.

연산자

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

메시지

OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
OnCollisionStayOnCollisionStay is called once per frame for every Collider or Rigidbody that touches another Collider or Rigidbody.
OnTriggerEnterWhen a GameObject collides with another GameObject, Unity calls OnTriggerEnter.
OnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
OnTriggerStayOnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer so it won't necessarily run every frame.