Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question BoxCastAll not detecting if target object has rigidbody

Discussion in 'Physics' started by OgreHeadStudio, Oct 28, 2022.

  1. OgreHeadStudio

    OgreHeadStudio

    Joined:
    Jun 27, 2016
    Posts:
    3
    My problem is that I am doing BoxCastAll and it is only working if my target object only have collider on it but it always fails when I attach rigidbody to my target. Is this by-design or something else ?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    It's not clear what is meant by "target objects".

    The title of your post would suggest you're asking if only Static colliders (colliders without Rigidbody) are supported and detected queries which would make the physics engine useless if that were the case.

    Despite the misleading title, that's not what is happening so you're doing something else wrong. No idea what that is.

    I would suggest clarifying what you're doing here by providing some specific details. Maybe some script using code-tags might help. It might then be clear on what you're doing wrong.

    NOTE: It's not clear if this is 2D or 3D physics.
     
  3. OgreHeadStudio

    OgreHeadStudio

    Joined:
    Jun 27, 2016
    Posts:
    3
    Sorry for being unclear but by target I meant the object my BoxCastAll trying to detect and that target is nothing but just a simple-default cube and if I add rigidbody to that cube then boxcasting is failing but it works if I remove the rigidbody. It is 3D physics. The cube is under Default layer and in BoxCastAll I am sure I am passing this layer, but as you said that nothing is wrong with boxcasts and rigidbody then I will try to find the error on my end
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    If the Rigidbody you add is Dynamic with gravity then perhaps it's falling out of the way. Who knows but rest assured, this is one of the most basic things you can do so works fine but without some extra information showing some script or configuration, it's impossible to help further.
     
  5. OgreHeadStudio

    OgreHeadStudio

    Joined:
    Jun 27, 2016
    Posts:
    3
    Either RigidBody is dynamic or not, it is not working in any way and sorry I can't show the script, but I am using Rigidbody.velocity to make my character move and even fall and one thing I want to mention here if it helps in any way that normal Physics.Raycast works all fine just this BoxCastAll is failing for some reasons
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,620
    Then I'm not sure how you can expect anyone to help. You have everything in front of you, we have nothing, just your description of it not working.