![]() ![]() To learn more about using Raycasts in a 2D scene see the documentation for Physics2D.Raycast. Physics.Raycast will interact with 3D Colliders, Physics2D.Raycast will interact with 2D Colliders. These have a different syntax and the two raycasting systems are not intercompatible. Variants of the 3D Raycasts and its alternatives can be used when your using Unity’s 2D Physics system. This functions identically to a Raycast however instead of expecting an origin and direction and LineCast expects two points and detects if an object is between those two points. CapsuleCastĬapsuleCast projects a capsule along a ray and can be useful for detecting things like potential player movement. BoxCastīoxcast projects a box along the ray and allow you to test if a box may move without colliding with an object. This has a few uses but one of the most common is in the development of third person cameras to prevent them from clipping into level geometry and ensure they behave more cleanly in tight corners. SphereCast projects a sphere along a ray effectively allowing your raycast to have a radius around itself when detecting objects. These function similarly to raycasts for the most part besides having a different shape. Unity includes a set of functions that can be used in place of raycasts that use different shapes such as spheres or boxes to detect collisions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |