Due to a request from a colleague, I decided to try and implement drop-able objects. Now, I admit that I have no intention or even the implicit one to override the missile or what ever mechanics x-plane already does.
The idea was to define a simple mechanism that will allow a simmer to drop an object from plane, and the designer can define that the target will be accomplished only when it will be hit.
So how it was implemented:
- First: We need to define how many drop-able objects we have, in the step.
- Second, define a 3D object file that will be dropped and be seen in x-plane world.
- Third: define a "trigger_zone" or a "target" that will have the <hit> element in it, so it will be accomplished only when hit.
It is important to note, that not all triggers/targets support <hit> element. Only: static_target, move_obj3d, dynamic_target, trigger_zone, attached_event support this option, which should be enough for most cases. - Forth: define the radius of success. Now this is a tricky one. The radius can be defined as the "source" one or "target" one.
If the designer picks the target (also the default) then it will use the "success_distance_nm", But if the designer chooses the "source" option, then it will calculate hit using "radius_mt" attribute which defined under the "drop_object" element. - Fifth and last: define the list of targets that can be hit by the dropped object. This means, that the designer define what is important to check or not in the current step. If we define many objects in the mission, there is no reason to go and test them all if only one is defined as "hit-able" target.
The only thing that is missing, is how to drop the "object". Well, for that I have created a "Custom Command" which you can map to your Joystick or Keyboard ( I mapped it to [ctrl]+[D] ).
Ok, enough talking, here is a short movie that describes more/or less how it is implemented.
The movie was taken in designer mode, so all GL Cues are visible ( no sound was recorded ).
I hope you get the overall idea.
You can see at the end of the clip, that once the object fell inside the "static target" (green circle), the debug widget displayed the target as "reached - yes". This is one target out of two, in this step.
That is it for now, there are other features added to the beta version, but they are mainly flow control and state control. I might write about them, but I hope to finish Beta soon, in order to be able to publish it.
Until next time,
Saar