# Question Check for anything a collider will hit given an angular velocity (rotation sweep)

Discussion in 'Physics' started by rherring, Mar 31, 2021.

1. ### rherring

Joined:
Mar 29, 2021
Posts:
2
Does there exist some sort of function or method to check if a (3D) collider will hit something if you give it a position and rotation to move next frame, like a rigidbody.sweeptest that also takes an angular velocity?

For example, in the attached crude drawing I have a box, and I want it to both spin about 90 degrees around its center, and move a few units to the right next frame.
I would like to somehow pass these velocities to a function and get information about what colliders would have been hit by it (and maybe the time of impact during the translation/rotation from 0.0-1.0).

Basically I'm looking for a raycasthit struct for the red x in the drawing, where the rectangle would have collided with the smiley face given the rotation and translation.

Looking through the docs I couldn't find anything that describes what I want; for linear motion theres a bunch of easy options like rigidbody.sweeptest or physics.boxcast, but nothing I can find for linear & angular motion;
I just wanted to know if there was something I was missing.

There was just one thread I found (SweepTest() for object rotation - Unity Forum) about this that I replied to asking the same, but the OP was from ten years ago and thought I might have better luck making a new thread.
Thanks in advance for any info.

_eternal likes this.
2. ### CCrowell

Joined:
Mar 31, 2022
Posts:
8
Did you ever find a solution for this? I am having the same issue.

3. ### _eternal

Joined:
Nov 25, 2014
Posts:
251
It's interesting that a solution doesn't seem to exist, and it makes me wonder how games with complicated physics handled this problem. This is an issue even in 2D (e.g. a kinematic laser that rotates quickly and skips its collision with the player).