Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Make Enemy look & shoot at randomly chosen transform point from array

$
0
0
Hello guys. I'm currently stuck with an issue and somehow I can't get it to work. I'm trying to make a droid from Star Wars and the droid is currently shooting in the middle of the Capsule "Player". Now, I would like to make it a little more advanced and complicated. The droid should randomly choose between a certain amount of hitboxes (transform points) located around the player. Droid picks a position (hitbox) & rotate towards (LookAt), shoots pick another hitbox, rotate, and shoots. Just randomly chosen from the array. The shooting and movement work already. Just the random picking hitbox point keeps annoying me. I'm currently using "**transform.LookAt(player)**;" and I would like to swap player with the chosen hitbox (transform) if possible. I've looked into random.range and all that stuff but really can't figure out how to code it. After each bullet, the droid should pick another point or the same one to rotate towards, just a randomly chosen one. Thank you! Following a pic of the scene: ![alt text][1] [1]: /storage/temp/168229-hitbox.png

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>