Ability to toggle object's physics through triggers?

I want to animate a crate being destroyed. I want the debree to fly everywhere, however, the crate needs to movable initially and I do not want that. I came across plenty of other scenarios that required the object’s physics to be toggled via trigger.

Can this be implemented, thank you

Hey Muphins,

I don’t fully understand either your question or the problem you’re having. You can toggle the physics on and off via the “enabled” property behavior.

If I was going to make an exploding box, I would probably set it up so that you make separate debris objects. Then when you destroy the box, have it emit some debris objects and destroy the box object.

Here is a quick example I put together for the exploding object:

http://flowlab.io/game/play/35277

I just have the box emit a few debris objects, play a sound, and then destroy itself. The debris objects also have some logic to pick a random direction and give them a bit of speed.

Let me know if you have any questions.

Ah. Well that certainly clears things up, I would not have thought to put that together on my own. Although I do have 3 questions.

I’ve noticed the destroy behavior is at the very end of everything. Now don’t get me wrong, the destroy behavior is a necessity and all, but it still throws me off. For one, I don’t know if the behaviors in the object will terminate (period, regardless of timers, objects emmitted) after it is destroyed. Simply put, I was surprised the debris still spawned even though the needed object was destroyed. Is that why you put the destroy behavior at the very end of everything?

The “forward” input in the “impulse” behavior. Trust me, I’ve looked through the index and I’m still not sure what it does. I assume the object impulses forward based on the preceding trigger/behavior?

If the “enabled” property behavior toggles physics on/off…then why does the index state “the object’s behaviors”? That’s a bit misleading in my honest opinion. I thought behaviors and physics were two separate things?
Aside from that, my question was a bit misunderstood. I want (I’m not trying to sound demanding here) specific physic properties to be toggled. For example; when “person” collides with “floor”, toggle “affected by gravity”. I personally don’t understand why someone would want to do that either, but that’s just an example to get my point across.

I’m sorry if you perceived these question to be unnecessarily long. I tried my best to communicate my questions and not waste your time. I really do like this software, and my friend and I are planning on buying a membership very soon. The only thing that’s impeding us from doing so are trying to learn the anatomy of triggers in correlation with the properties/behaviors. Again, I hope questions are not a problem for the forums (provided I search the forums myself and browse through the website).

Destroy goes at the end because it terminates the object functions entirely.
Forward impulse impulses whatever direction the object is facing.
Enabled cancels everything including movement, gravity, messages, collision, everything. You are basically a background object.

I’ve noticed the destroy behavior is at the very end of everything. Now don’t get me
wrong, the destroy behavior is a necessity and all, but it still throws me off. For one, I
don’t know if the behaviors in the object will terminate (period, regardless of timers,
objects emmitted) after it is destroyed. Simply put, I was surprised the debris still
spawned even though the needed object was destroyed. Is that why you put the
destroy behavior at the very end of everything?

Yeah, the “destroy” behavior literally destroys the object completely, so that has to be the last thing it does.

The “forward” input in the “impulse” behavior. Trust me, I’ve looked through the index
and I’m still not sure what it does. I assume the object impulses forward based on the
preceding trigger/behavior?

This could probably be more clear, sorry about that. Every object has a “direction”. By default the objects direction is “right”, but you can adjust that in the object’s settings (click on the object->Edit->Properties). The “forward” direction also changes if you rotate or flip the object. The “forward” input on the behaviors like Impulse and Motor just give you a handy way to make an object go in it’s forward direction without having to keep track of what direction it is facing. Does that make more sense?

If the “enabled” property behavior toggles physics on/off…then why does the index
state “the object’s behaviors”? That’s a bit misleading in my honest opinion. I thought
behaviors and physics were two separate things?

They are separate things, I will update the documentation page to be more clear :slight_smile:

Aside from that, my question was a bit misunderstood. I want (I’m not trying to sound
demanding here) specific physic properties to be toggled. For example; when “person”
collides with “floor”, toggle “affected by gravity”. I personally don’t understand why
someone would want to do that either, but that’s just an example to get my point
across.

Well, “affected by gravity” is a very new property, so no behaviors address it specifically. Right now, there is only “enabled” which disables/enables all of the physics (and stops behaviors). It would be possible to make behaviors that disable/enable specific facets of the physics (gravity, collision, etc), but I haven’t really had anyone ask for that (before now). Also, I haven’t really run into a case yet where it is required, but it is certainly worth discussing :slight_smile:

I’m sorry if you perceived these question to be unnecessarily long. I tried my best to
communicate my questions and not waste your time. I really do like this software, and
my friend and I are planning on buying a membership very soon. The only thing that’s
impeding us from doing so are trying to learn the anatomy of triggers in correlation
with the properties/behaviors. Again, I hope questions are not a problem for the
forums (provided I search the forums myself and browse through the website).

No need to apologize at all, these are all good questions, and I hope I was able to clear some things up.