Answer the question
In order to leave comments, you need to log in
What analog can be found for Physics.SphereCast?
The video is an example of what I need to achieve.
I'm trying to make the movement of the chip equal to its diameter, the movement is instantaneous and only in free space. To improve the display of such a movement, we decided to make a stroke that he can go to.
Physics.SphereCast is a good method, the method almost came up, but one nuance interferes with the gameplay.
In this situation, the token cannot move to an empty cell marked with a black outline, due to the fact that the SphereCast collides with an object in the green-colored space.
I need to find another solution to this problem, or use crutches for SphereCast.
Here is the code:
origin = transform.position;
direction = transform.forward * (-1);
RaycastHit hit;
if(Physics.SphereCast(origin, sphereRadius, direction, out hit, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal)){
currentHitObject = hit.transform;
currentHitDistance = hit.distance;
} else {
currentHitDistance = maxDistance;
advanceDisplay.position = transform.position + (transform.forward * (-1) * currentHitDistance);
currentHitObject = null;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question