Hi everybody!
I have a ball in the game I am making, and would like to test for objects touching it using a trace. SphereTraceByChannel almost does what I want, but if I set the start and end points to the same vector, it tests against a capsule shape, not a sphere.
In general, my confusion is this: why doesn’t a SphereTraceByChannel test against a perfect sphere when the start and end points are the same? Can I not perform a “sweep” with a sphere at a single point?
Here’s a picture of what I’m talking about (trace with same start/end):
I have my own physics simulation I am trying to integrate, and it depends on being able to determine contact with other surfaces along the ball’s surface. Since I can’t get the sphere trace to align with the ball’s shape, the simulation is broken.
Any suggestions? Please let me know if I can provide any additional information. Thanks!
Update:
Just in case weary internet travelers arrive here, I noticed some odd behavior about sphere traces that may be interesting:
SphereTraceByChannel will perform an overlap test if the start and end points are the same, but return an incomplete hit result. In this case, ImpactLocation and Location will be the same point since it is no longer a sweep.
To get the expected (depenetrated) Location result, you need to do a line trace from the start point following the negated normal of the SphereTraceByChannel hit result to determine the contact point of the sphere trace. You can then use that result to determine how much the sphere would need to move to no longer penetrate the contacting surface.
Hope that helps somebody.