Jump to content

[SOLVED] multiple trigger deleting


photo

Recommended Posts

Hello,

I am trying to remove multiple trigger created by following code

 

And I am using trigger.setEnterCallback(0) to remove the PhysicalTigger but I am facing an issue in removing them. Below mentioned is the scenario.

 

The trigger.setEnterCallback(0); works if I have only one trigger, but when I have more trigger it is not working.

 

int size = 0;

for(int x = 0; x <= size; x++)

{

ObjectMesh mesh = add_editor(new ObjectMesh("TestWork/assest/worlds/meshes/sphere_00.mesh"));

mesh.setWorldTransform(translate(Vec3(x, 0, 0.25f)));

}

 

For each mesh Object I place an Physical Trigger using my custom object "trigger" over it's location & set respective callback (Enter & Leave)

 

trigger.setEnterCallback("enter_callback", x);

 

Now I am set triggerEnterCallback(0, x) in enter_callback() function after all my operation are done in this function

 

But the trigger is till existing, how can I remove the trigger in above mentioned problem.

 

Thanks

Link to comment

PhysicalTrigger is node just like any other node in the scene. Meaning you can delete as a node:

  • If you create it in script:

delete trigger;

  • If you create it in the world via the editor:

engine.editor.removeNode(trigger);

Link to comment
×
×
  • Create New...