playMaker

Author Topic: Physics > Explosions & Layers  (Read 2202 times)

hunz

  • Playmaker Newbie
  • *
  • Posts: 35
    • View Profile
Physics > Explosions & Layers
« on: May 06, 2013, 08:22:56 PM »
Hey, I've asked for help on the following but it was suggested that I get a plug in to do the layers.  I don't really understand as the action has a layer set up on it.

I'm running 2 explosions at the same time.

A forces in.
B forces out.

A has a unique layer ID "player" that a I've placed a few game objects on.
B has a unique layer ID "object" that a I've placed a few game objects on.

Once running all game objects are effected by both explosions.

I thought placing them on layers would allow only those on it to be affected by the force given.
« Last Edit: May 06, 2013, 08:30:34 PM by hunz »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15398
  • Official Playmaker Support
    • View Profile
Re: Physics > Explosions & Layers
« Reply #1 on: May 07, 2013, 12:52:25 AM »
Hi,

 can you reference where you come from with this, who suggested to use what? I am not too sure about this, and that could be important to answer correctly.

 based on what you say however, I think that you are confused with the way you apply forces. Can you describe how you define the force you apply for A and B?

bye,

 Jean

hunz

  • Playmaker Newbie
  • *
  • Posts: 35
    • View Profile
Re: Physics > Explosions & Layers
« Reply #2 on: May 07, 2013, 01:44:19 AM »
Hey,

Thanks for the response.  The original help was here : http://hutonggames.com/playmakerforum/index.php?topic=3816.0

The idea is that when you touch an area on the screen 2 physics > explosions happen.  One sucks towards your finger and attracts objects the other pushes the player away.

So I set 
physics > explosion
force +.1
Force Mode = Impulse
Layer = Player
Every Frame

physics > explosion
force +-.1
Layer = Object
Force Mode = Impulse
Every Frame

I then have the game objects set to right layers to make sure they filter the corresponding explosion.

My apologies if this is newb and not bug.  The help given didn't really explain why the layers were not filtering the right objects.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15398
  • Official Playmaker Support
    • View Profile
Re: Physics > Explosions & Layers
« Reply #3 on: May 07, 2013, 09:43:23 PM »
Hi,

 I am not sure there is such system that allows you to add force on a per layer bases. Maybe a framework on the asset has created this, but I don't think it's available as a built in feature of Unity.

If I was to do this, I would either implement on each object a fsm that will add the force when required, or maintain a list of my objects per layer and add force to that list in a loop ( but I would try the first approach first)

 Bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2494
  • Mender of the past
    • View Profile
    • Cleverous
Re: Physics > Explosions & Layers
« Reply #4 on: May 08, 2013, 03:49:48 AM »
I am not sure there is such system that allows you to add force on a per layer bases. Maybe a framework on the asset has created this, but I don't think it's available as a built in feature of Unity.

A little off-topic but Circular Gravity Script on the asset store has a built in tag filter to apply force to objects with a certain tag, I'm sure you could use that as a reference if you wanted to do it for layers. Just glacing at it, it is quite simple and works consistently for $5.