Be the first to post for 'Spawning Enemy Projectiles'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

Not sure if i missed something in the earlier videos or if this is an issue with the projectile we use but i found mine would not move from the enemy player.
The reason was Is Kinematic was on in the projectile.
Turning this off solves the issue but i dont remember this in the video.

4 Likes

Thanks Marc.

Out of curiosity what is the best way to handle projectiles hitting other enemies? Would there be a way to ignore colliders/collisions on a certain layer or perhaps give the projectiles some sort of creator ID? I hesitate to just split the health values into enemy health and player health. but that is another method that occurs to me. I just see a lot of situations at the moment where my enemies kill themselves as much as me and was wondering how that sort of thing is handled.

edit: well not sure if it is the best method but making a new layer called Enemy Projectiles and then assigning the projectiles in question to that layer and going edit>project settings>physics and unchecking the box that relates to collisions with enemies and enemy projectiles seems to do the trick.

Hi there, I plan to do this using Layers not matching in my next video after Rick’s series.

Thanks! This was helpful!

1 Like

Thank you so much! I was struggling to figure this out for a while

1 Like

I’m not too clever when it comes to math so I might be way off here, but could we have used Vector3.Distance () or Vector3.magnitude in the SpawnProjectile method?

@Marc_Carlyon Thanks for mentioning the ISKinematic thing. Mine wasn’t moving and it was due to having forgotten to turn that off!

1 Like

Hello All!

I completed this lecture, but began experiencing several issues. None of the other posts above mention any but I wanted to post for advice.

  1. My enemy projectile works, but my frame rate drops like crazy when he starts firing and I get close to him with the player character. FR always starts 90-101, then when the enemy starts shooting its drops drastically per second. It went down to 30 once. And that’s just with one enemy in the game; I removed everyone else.

  2. When I get close to the enemy, my player character starts doing that “funny dance” I’ve seen in other posts. He kinds just rotates around and tries to move to where I click. Sometimes he figures it out, sometimes not. It doesn’t happen tho until I get close to Borris (the enemy).

I plan on running through this lecture again to see if I can make any improvements. If screenshots of any particular components would be useful, I will get them ASAP.

Thx

[HELP] I’m having issues with the projectile. For some reason the enemy isn’t targeting the player when I enter attackradius but for some reason is targeting the enemy transform. When I get in it’s chaseRadius it targets the player to chase but not attack.

Everything working re projectiles but using Chinese stars (martial arts weapons) and they seem too small. I can barely see them on screen. Perhaps adding particles or FX may help? Replaced Ethan enemy with Chinese farmers who are chasing after the Terra Cotta warrior. Turned environment into ancient Chinese village. So far, so good, and thoroughly enjoying this RPG course!

1 Like

ok, i must’ve missed something in the earlier videos

if i make my player kinematic, it can’t move (i am not supporting click to move). if i make my player collider a trigger, i fall through the world. what am i missing?

Same issue here. Additionally, I could not find any projectile prefab in the asset packs I downloaded for these lectures so I had to make one from the rubber ball, which I eventually saw had a some scripts we didn’t need on it. It mostly works for me now, when I stopped making it a trigger and kinematic, but I’m finding it bounces weirdly after it hits the player’s feet, like it’s in the vacuum of space.

Another solution: have the projectile’s transform LookAt the player and then use the projectile’s forward vector X the speed.

1 Like

Privacy & Terms