Being a newcomer to Unity, I try to have several instruments to be handled by one script. They have a collider that is triggered by the script but how do I know, from the script, which collider is activated by the mouse? I detect for example by:
Input.GetAxis(“Mouse X”)
which direction steering wheel or throttle must go, but I don’t know how to sort them out. Thanks in advance.
Cheers,
Michel
Fattie
October 25, 2012, 7:52am
2
if you have many object it’s possible you’ll have to use a POOL
this is somewhat advanced but eventually you will have to do all this:
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
regarding your question of simply how to “touch” objects in the scene.
there are fortunately many many questions on here about the issue.
i urge you to learn about raycasting. you just raycast in to the scene from the screen, and see what you hit.
here is an ADVANCED discussion about subtleties about the issue
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
I can’t immediately find a good beginner tutorial on the specific subject. it is a basic in Unity and all game engines.
pls simply look in the scripting docs under raycasting etc, there may be a basic example right there
hope it helps!