i will try to explain my situation:
the purpose of my game is to collect diamonds. the game world consists out of different “islands” where the diamonds are situated. You have to jump from island to island to collect the diamonds.
The diamonds should be placed randomly on these island. My thought was to create some sort of diamondcanon up in the air, that shoots diamonds to a random empty game object on one of these islands. i succeeded to shoot a diamond out of my canon with the following code:
var instantiatedProjectile : Rigidbody = Instantiate(projectile, transform.position, transform.rotation );
instantiatedProjectile.velocity =transform.TransformDirection( Vector3( 0, speed+numberOfDiamonds, 0 ) );
instantiatedProjectile.name="DiamondPrefab"+numberOfDiamonds;
my question is, how can i make the canon shoot at the direction of a certain game object. Now it just drops the diamond, but how can i “aim” the canon to a certain empty game object.
I hope my idea is the best way to achieve this, other suggestions are welcome as well.