how to shoot at random position ?,Fire bullets at random position by enemy
the scenario is enemy shoots at give random position that is public transform[] target; void shoot() { int randnum=random.range(0,target.length) instiate(bullet,target[randnum].position,quaternion.identity) } right but it instiate the bullet at random position rather to fire at that position i done all the possible ways in last 10 days but still didnot get the proper and perfect solution because randnum is int and it cannot be converted in vector or something else hence it canot working perfect i also implemented addforce methods but it not perfectly hit the randnum position rather it goes side ways please help me ,the scenario is that a enemy should shoot at randomposition from array that is public transform[] target; void shoot(){ int randomtarget= random.range(0,target.length) instantiate (bullet,target[randomtarget].position,quaternion.identity; } but it instantiating at the target not fire form fire point i done lots of code and try almost everything but wasting my 10 days but not yet get a perfect solution so kindly help me
Your answer
Follow this Question
Related Questions
Random.Range code problem or problem with Unity? 1 Answer
how to randomly instantiate prefabs but each with it's own probability? 2 Answers
How do I generate a random number in regular time intervals? 0 Answers
What range of values need to be inserted if we need to pull a random item from the list? 0 Answers
Can I generate values outside of the Random.insideUnitCircle?? 1 Answer