0
\$\begingroup\$

I want a raycast direction not relative to the rotation, but what happens is that the raycast points to one place as if it was a transform.forward

Why is the happening help


if(Physics.Raycast(transform.position, vector3.forward, out hit, SupportedDistance, CanBeSupported))
{
     NotSupported = false;

    //
}
\$\endgroup\$
3
  • 1
    \$\begingroup\$ I'm sorry but I don't understand your question. What do you want to achieve here? A Raycast from an object and pointing to a specific object? \$\endgroup\$
    – lvictorino
    Oct 24 '19 at 18:34
  • \$\begingroup\$ The code you've shown here (neglecting the incorrect capitalization) fires a ray in world space. If you are observing symptoms that make it appear as though it is not using world space, then you should walk us through the complete steps we need to reproduce these symptoms in a new Unity project. Tell us exactly how to set up the test scene, what output you expect, and what output you observe instead. \$\endgroup\$
    – DMGregory
    Oct 24 '19 at 22:47
  • \$\begingroup\$ Yeah i think i fixed it. I was overlooking again : ^ ) my apologies and thanks for the help still. \$\endgroup\$ Oct 25 '19 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.