Hi, I’m new to scripting, I am trying to make a drumming simulator for android.
I used Raycast to trigger the animations and sounds, everything is working fine, but when I build it on Android, the Raycast only hit one object at a time, how do I make multiple ray that hit multiple object at once? here is my code
Ray ray;
RaycastHit rhit;
void Update()
{
ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Input.GetMouseButtonDown(0))
{
if (Physics.Raycast(ray, out rhit))
{
if (rhit.collider.gameObject.name == "Snare")
{
//PlaysoundAndAnimation
}
}
}
}
I am not sure if it is Input.GetMouseButtonDown and Input.mousePosition, should I change it to touch? if so how is the right thing to do it, or is there any better way to achieve multi touch at once beside Raycast?