playMaker

Author Topic: Disabling gravity in a 2d game  (Read 1330 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 334
Disabling gravity in a 2d game
« on: January 04, 2021, 12:29:30 PM »
Hello, I'm following a tutorial on how to make ladders for a 2.5d platform, though I'm modyfying it for completely 2d. However, I'm having a problem. I can't use the "use gravity" action because it requires me to put a normal rigid body (not rigid body 2d) on it and there is no 2d equivalent. As a result, I cannot disable gravity. I suppose hypothetically I could make everything not in 2d (box colliders, etc.), but I'm sure there is a better solution, but I just don't know it. Is there a way to disable gravity without using the "use gravity" action? Let me know. Thanks!

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Disabling gravity in a 2d game
« Reply #1 on: January 04, 2021, 06:09:41 PM »
I haven't tried creating a ladder (that sounds cool) but if you type gravity into the action browser there is a Set Gravity 2d Scale action (Just set Gravity Scale to 0 and its off, set it back to 1 and its on ;).

Also on the actual game object when you click Add Component type rigidbody and you should see Rigidbody 2D.

hope the ladder system is cool.
Have I said how much I love playmaker!!! This is one amazing tool

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Disabling gravity in a 2d game
« Reply #2 on: January 04, 2021, 06:16:32 PM »
Hi.
As LuminRabbit suggested, "Set Gravity 2d Scale"
It will set the gravity on a 2d object.

You might also want to use "Set Rigid Body 2d Constraints"
if when on ladder, the player is not allowed to go left/right.