- Home /
How To Make The Raycast Thicker!
Hello Everyone i want to know how to make the Raycast Thicker
i use this code
if(Physics.Raycast(transform.position + new Vector3(0,0.6f,-1.6f),transform.TransformDirection(Vector3.forward),out hit)){
}
Answer by TonyLi · Apr 01, 2013 at 01:33 PM
http://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html
float thickness = 1f; //<-- Desired thickness here.
Vector3 origin = transform.position + new Vector3(0,0.6f,-1.6f);
Vector3 direction = transform.TransformDirection(Vector3.forward);
if (Physics.SphereCast(origin, thickness, direction, out hit)) {
...
}
I didn't realise a SphereCast worked this way! I thought SphereCast was the same as CheckSphere >< Purged my silly suggestions and rating you guys up :)
Answer by Eric5h5 · Mar 31, 2013 at 05:42 PM
You can't make a raycast thicker; a ray by definition is one-dimensional. You can try using a spherecast instead.
more info about spherecast Please? can you right the C# code
using my vectors
spherecast is spherecast. you can use multiple raycasts(like 3 or 4) in a small area to simulate a Thicker raycast.
i want thicked raycast because i need this :
when i'm aim on the box, will show GUI.label "its a Box"
but with raycast its only show when i AI$$anonymous$$
i need it to showup when the box in range around the raycast
any ideas? and sry for bad english
Your answer
Follow this Question
Related Questions
Having a RaycastHit event create a component? 1 Answer
Problem With RayCast 3 Answers
thousands of raycasts in nested for loop 0 Answers
Need help with Raycasting 1 Answer
Raycast problems in my AI 1 Answer