#How can i use raycaste and it's alternative

1 messages · Page 1 of 1 (latest)

zenith swallow
#

???

#

tf does 'raycast like the yellow' mean

#

explain more and ill try my best to help you

slender peak
#

I think he mean to draw the raycast

#

[]cb

jovial micaBOT
#

Use codeblocks to send code in a message!

To make a codeblock, surround your code with ```
To use C# syntax highlighting add cs after the three back ticks.

For example:
```cs
Console.WriteLine("Hello World");
```

Produces:

Console.WriteLine("Hello World");

To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.

zenith swallow
#
Physics.Raycast(**parameters here**);
slender peak
#

And it's like somethig :

using UnityEngine;

public class RaycastDebug : MonoBehaviour
{
    public Transform origin; // The starting point of the raycast
    public Vector3 direction = Vector3.forward; // The direction of the raycast
    public float maxDistance = 10f; // The maximum distance of the raycast

    void Update()
    {
        // Cast a ray from the origin in the specified direction
        Ray ray = new Ray(origin.position, origin.TransformDirection(direction));

        // Perform the raycast
        if (Physics.Raycast(ray, out RaycastHit hit, maxDistance))
        {
            // Draw a green line to the point where the ray hits
            Debug.DrawRay(ray.origin, ray.direction * hit.distance, Color.green);

            // You can also log information about the hit if needed
            Debug.Log("Hit: " + hit.collider.name);
        }
        else
        {
            // Draw a red line in the specified direction if no hit occurs
            Debug.DrawRay(ray.origin, ray.direction * maxDistance, Color.red);
        }
    }
}

#

That Debug.Draw

gray jacinth