2d射线检测
1 RaycastHit2D hit2D = Physics2D.Raycast(GetComponent<Rigidbody2D>().position + Vector2.up * 0.2f, lookDir, 1.5f, LayerMask.GetMask("xxx")); 2 if (hit2D.collider) 3 { 4 Debug.DrawLine(hit2D.point, hit2D.point + lookDir, Color.red); 5 }
Powered by: 博客园 Copyright © 2024 ZERO_BEYOND Powered by .NET 9.0 on Kubernetes