Answer the question
In order to leave comments, you need to log in
How to make objects not ignore colliders?
The problem is that I made a script to hold the object with the mouse, but .. when you drag it to any collider, it does not get stuck, it just goes through it, and sometimes the code sits right in the collider itself
:
void OnMouseDrag()
{
Vector3 mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance); // переменной записываються координаты мыши по иксу и игрику
Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePosition); // переменной - объекту присваиваеться переменная с координатами мыши
transform.position = objPosition; // и собственно объекту записываються координаты
}
Answer the question
In order to leave comments, you need to log in
Try moving through a rigid body.
var rigidbody = GetComponent<Rigidbody>();
rigidbody.MovePosition(objPosition);
objects did not ignore colliders
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question