Page 1 of 1

How to create and use triggers

Posted: Mon Oct 03, 2011 12:56 pm
by omg_fail
Hello guys!

I wonder on how to use and create triggers in my 3D scene.So for example , if i go into a door , igot into another part of the map , or into a new map.
I read something about luna script but i am not sure about this.

Re: How to create and use triggers

Posted: Mon Oct 03, 2011 2:37 pm
by serengeor
Scripts won't help you to create such things. You need to find a way you can get collisions between objects, in you situation trigger(plane,box,mesh,..) and some other object.
I don't think I read the same thing about luna script, because from what I read it's used for web app development..

Re: How to create and use triggers

Posted: Mon Oct 03, 2011 5:10 pm
by CuteAlien
You have to code a trigger-system yourself. Basically it's like serengeor mentioned - you check for collisions. So you create invisible meshes and then check for collisions between those and the objects of interest each frame.

Re: How to create and use triggers

Posted: Mon Oct 03, 2011 5:32 pm
by omg_fail
Yes , using a mesh as a invisible bounding box was what I thought too.

The thing with the luna script was because I saw it in the wow folder of my friend , and it contains some coords...but nevermind.

I will see if I have the know-how to do it.

Thanks so far

Re: How to create and use triggers

Posted: Sat Oct 08, 2011 4:15 am
by Virion
I just use a vector to store all triggers and use a for-loop to check collision with player every frame.

Re: How to create and use triggers

Posted: Sat Oct 08, 2011 10:01 pm
by omg_fail
Thats a very good idea with the vector. Thanks will try it this way

Re: How to create and use triggers

Posted: Tue Oct 11, 2011 6:16 pm
by Virion
if you want to boost performance you can try not to check collision every single frame. you can check it like every xx miliseconds so that the performance will improve slightly. the downside is, it is less accurate, not good for fast moving objects. if your object moves very slow, you can reduce the collision-check rate even further.

Re: How to create and use triggers

Posted: Tue Oct 11, 2011 7:56 pm
by Iyad
Im used to create invisible boudning boxes and detect interation to, but what I would suggest if you want tons of triggers in your map, to partition them (using a tree like structure) and then evaluate (using a for-loop) depending on your position if it is possible to interact with something in your region or subregion. This can be efficient if you have tons of npc's, destructible environment or if you simply want a full interaction with your environement.