I feel like I'm getting the hang of Unity. My code looks so clean and professional now!
I think the 3D models have too many polygons, though, since my FPS is always lower than like 7
I'm working on an open world horror game with lots of gore and strange characters.
If you want to help me out, please consider wishlisting the game and following me:
@Phantom_TheGame
This is pretty good. But I personally would do the loop a 2nd time. Just to make sure that it really found the nearest enemy. I call it a pro developer move 🤓
@MrGemezl
Yeah, I was actually worried the code might miss the nearest enemy. Could do a second loop with another variable of Enemy and do a "if(nearestEnemy == nearestEnemyJustMakingSure) { bla bla}", and probably put it all in a while loop until those two are the same
@Phantom_TheGame
you can actually make this a little tighter by measuring to its vertices instead of just the origin
there's also an optimization for distance checking using squared magnitude!
here you go:
@sefless
Ohh
I was actually gonna do float.MaxValue, but I though it would require a lot of ram since the number is so high.
Thanks for explaining though