[SOLVED] About (On Volume trigger) array?

hi guys

I have a question.
could we make a node of (OnVolume array)?
so these days i was testing the functions of (navmesh) and i found the problem that collisions cannot be added to (navagents).
(because I wanted the “navegent” to chase the “player”)
So I decided to use node (Onvolume) to cause “damage” to objects that are “navagents”
(oriented to generate objects that are applied as “enemies” and are damaged by “bullets”).
And as you can see in the file that I share with you, this fixes it in a certain way, but I must say that from time to time it generates an error and removes the “base object” in the “Enemydamage” collection as soon as the program starts the project. … .
Without further ado, if anyone knows of another way to do this, I’d like you to let me know.

Check the tree nodes (LifePlayer) and (LifeEnemy)

1 Like

Hi, before I could answer your questions, I need some clarifications:

  1. Why do you use the pulse node here? Does a single bullet affect the enemy multiple times? Does the bullet not de-spawn after colliding with the enemy?

  2. In the “Fire_Normal” logic tree, what does this section of the code do?


    If it is to de-spawn the bullet after a certain time, why not use a much simpler setup as a bullet object trait like so:
    image

1-Exactly, the bullet does more damage per frame.
Since I noticed that it takes time to get out of the enemy’s (volume) and therefore it applies more than one hit, it is the reason why I use the pulse, so that it only applies one damage
(2-3)-That is the (array) that I add to each “bullet” it generates, although I know I can do what is in point 3,I did not add it mainly because it was not my intention to generate “bullet”, it only used the root "bullet " to which the tree applies (Fire pooling)
this to reuse the same bullet and fire it every 0.8 seconds
and
(StopRB) (this one added to the root “bullet”) to remove all (impulse) and rotation from the “root bullet” whenever it hits a designated (collection) or upon reaching a certain distance

Okay,

While something like OnVolume array might be possible, it would be very inefficient and slow. It is instead better to use the Physics engine to our advantage.

The NavAgents can have rigid bodies. But they must be Kinematic Rigid Bodies. To make them kinematic, you need to enabled the “Animated” checkbox in the RB settings panel. Like so:

Additionally, if the bullet should or should not be affected by this RB will be controlled by this checkbox:
image
If the above checkbox is enabled, the RB will not affect other RBs. But collision can still be detected using nodes.

With these settings, you can now use the Get RB Contacts node to check if the bullets hit the RB.
image

Hope this helps.

2 Likes

Ok, I was not aware of that information, this afternoon I will do a file and tests.
Then I upload it to serve as an example to someone who needs it in the future
Thank you very much for the help and information about the navagent
have a good day :slight_smile:

1 Like

modified file with indices and some examples (nodeTree) with the main ones,for who needs it
(LifePlayerProp)(LifeEnemyProp)(LookatMouseLoc)(SpawnCollection(around a Obj))
(Spawn a ramdon Obj From a collection)
(Refire sameObj and remove RB Impulse)

https://drive.google.com/drive/folders/1kH-KVNheXMt9uDqXZr31_QZCMUn_fGQQ?usp=share_link

Edit:reuploaded with the (Bundled) folder to be able to see the (print property) LifeP and LifeE

1 Like