[SOLVED] Problem with spawned and collision

hello guys, I’m new to the forum and I’ve been with armory for a while,
I decided to open this thread to ask for help with a project.
the problem I have is with the collision of generated objects, my project intention is to make my character return to the control point if it hits a generated object but I can’t detect the collision with the nodes (On contact)(On volume trigger ).Besides that I saw a tutorial with a file that I thought would work with my project but it didn’t
By the way, I’m using version 22.05 in blender 2.93

https://drive.google.com/file/d/1OXdazvENqMgrEgcd0NS-N7n2kn9RinTG/view?usp=sharing

this is the above mentioned tutorial

Hi and welcome!

I think what you mean is that the collision detection does not work when used with “Spawned” objects. I believe the reason for this is the improper usage of objects for checking.

Here’s what I mean: Say you have an object “Cube”. At run-time, you spawn this “Cube” object. But the issue is that even if the old object and the new object are both called “Cube”, they are not the same objects. So you always check for collisions with the old cube and not with the newly “generated” cube.

I have made a small example here to show how it should be done. It is a simple example where cubes are spawned at random locations and if it detects collision with a plane, the cube will be removed.

I use something called “Self Object Reference”. Basically if an Object input socket in a node is empty (like in the image below), it refers to the object to which the trait is applied on. Since you do not specify an object here, it always refers to the current object and not the old object.

image

image

The above two images are equivalent.

You can find the online version of my example here. You can download the blend file here

Hope this helps.

1 Like

It worked, thanks bro. The truth is that I had been doing this for a few days and it became a bit tedious…
I implemented it in my project and it works great.
have a nice day :slight_smile: