playMaker

Author Topic: Add mass when collision 2D  (Read 3241 times)

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Add mass when collision 2D
« on: August 01, 2015, 12:57:51 PM »
Hello everyone,

Firstly, i just want to say thanks to all Playmakers contributors. You did some great works! ;)

I'm a new user of Playmaker. I'm working in my first game, and it's a flappy bird like with a lot of changes.

I have an issue. I would like to add mass to my object when it's enter in collision with an other one. But i want him to continue to jump.

The problem is that, after the collision, my object don't jump anymore.

Can you help me, please?

Thanks a lot! :)

 


merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add mass when collision 2D
« Reply #1 on: August 02, 2015, 06:46:06 AM »
Anyone can help me please?  :(

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Add mass when collision 2D
« Reply #2 on: August 03, 2015, 03:55:29 AM »
If you dont add mass, does it still jump after collision? How much mass are you adding? Unity say it mass should not be above 10 : You should strive to keep mass close to 0.1 and never more than 10. Large masses make physics simulation unsta le.

have you increase the force needed For the jump?

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add mass when collision 2D
« Reply #3 on: August 03, 2015, 07:18:34 AM »
Hello, and thank you for you reply  :)

When i don't add mass; my object still jump after collision.

I don't want to increase the force needed for the jump.

I just want to add a little amount of mass, after each collision. The jump will decrease, until my object can't pass obstacles, driving to a game over.

But when my object enter in collision, it keeps adding mass, so my object drops and it can't jump anymore.

I attached a screenshot of my FSM, and after one collision, the "add mass" was active even when there were no collisions.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add mass when collision 2D
« Reply #4 on: August 03, 2015, 01:07:18 PM »
Hi,
Hmm really strange the action "get mass" should only get the mass value of your object and is not setting (changing) anything
Only "set mass" will set (change) its value.

Also the state "add mass" is active but the action is greyed out which means the action has been done and not doing anything anymore  :)

so you should "get mass" then add wanted value and then "set mass"

but before you do so try to find out what is adding mass to your object

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add mass when collision 2D
« Reply #5 on: August 03, 2015, 03:02:28 PM »
Thank you for your answer.

I just connect "add mass" to "to init", and i have the effect i desire.

So after each collision, my object mass increase, and the jump is less high (it returns to "init/idle/jump").

But i just see that my object mass increase just after the first collision. The other collisions don't increased the mass (jump remains the same).

Do you know why?


« Last Edit: August 03, 2015, 03:26:08 PM by merde10 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add mass when collision 2D
« Reply #6 on: August 03, 2015, 04:52:09 PM »
Hi,
Yes because you are setting the mass to 1.7 every time and not adding
you should use an add float on the "mass" you stored and and use it on the Set Mass action.


merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add mass when collision 2D
« Reply #7 on: August 04, 2015, 10:22:22 AM »
it works fine!

thank you so much! :)

Regards, Sam.