M
M
Mak5AM2021-01-11 16:47:32
C++ / C#
Mak5AM, 2021-01-11 16:47:32

Unity Physics.SphereCast: what do the parameters mean?

Hello!

I have a question about the parameters of the Physics.SphereCast method.

I read the documentation, but still have questions.
This method contains the following parameters:

origin - The center of the sphere at the start of the sweep.
radius - The radius of the sphere.
direction - The direction into which to sweep the sphere.
maxDistance - The max length of the cast.

With the first two (origin and radius) everything is clear. This is the center point where the sphere with the given radius is created.
It's not clear to me how to use direction and max distance.
If the sphere is created at origin, how can it have direction and distance? Or is the sphere created at origin and moving in a given direction for a given distance?
Can you clearly explain how SphereCast works?

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-01-11
@Mak5AM

There is RayCast - shoots a beam from a point in a given direction, a certain length.
And there is SphereCast - the same thing, only the beam is thicker .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question