CHATGPT AI
Physics
.Raycast(ray, out hit))
{
if (hit.collider.gameObject == gameObject)
{
if (Input.GetMouseButtonDown(0))
{
OnClick();
}

if (Input.GetMouseButtonDown(1))
{
OnRightClick();
}

if (Input.GetMouseButtonDown(2))
{
OnMiddleClick();
}

break; // Stop looking for other objects hit by raycast. We only care about this one.
}
}

}

protected virtual void OnClick() { }

protected virtual void OnRightClick() { }

protected virtual void OnMiddleClick() { }

} // class ClickableObject3D
}
.Raycast(ray, out hit)) { if (hit.collider.gameObject == gameObject) { if (Input.GetMouseButtonDown(0)) { OnClick(); } if (Input.GetMouseButtonDown(1)) { OnRightClick(); } if (Input.GetMouseButtonDown(2)) { OnMiddleClick(); } break; // Stop looking for other objects hit by raycast. We only care about this one. } } } protected virtual void OnClick() { } protected virtual void OnRightClick() { } protected virtual void OnMiddleClick() { } } // class ClickableObject3D }
0 Comments & Tags 0 Compartilhamentos 1 Visualizações

Password Copied!

Please Wait....