Answer the question
In order to leave comments, you need to log in
How to make an object not pass through other objects?
I have a cube that, when clicked on Mouse0, teleports to the point where Arm is located. When I hover and click on the cube, these actions occur:
if (Raycas.rc==true)
{
myText.SetActive(true);
outline.enabled = true;
if (Input.GetKeyDown(myKey))
{
transform.position = arm.position;
transform.SetParent(arm);
rb.useGravity=false;
rb.constraints= RigidbodyConstraints.FreezeAll;
}
}
if(Raycas.rc==false)
{
myText.SetActive(false);
outline.enabled = false;
}
if (Input.GetKeyDown(myKey))
{
transform.position = arm.position;
}
if (Input.GetKeyDown(KeyCode.Mouse1))
{
rb.useGravity = true;
transform.SetParent(null);
rb.constraints = RigidbodyConstraints.None;
}
}
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