playMaker

Author Topic: how to eficiently determine if object falling or jumping?  (Read 4831 times)

EpoxaXD

  • Playmaker Newbie
  • *
  • Posts: 1
how to eficiently determine if object falling or jumping?
« on: April 08, 2025, 12:39:15 PM »
I want to set different mass depending on is object jumping up or falling down
When I try to just get velocity and compare to 0 every frame I hit a loop limit no matter how high it is
So instead of comparing every frame I added a wait state to compare it every 0.01
But is there better wait to do it?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: how to eficiently determine if object falling or jumping?
« Reply #1 on: April 21, 2025, 02:54:14 AM »
Hi,

 that's fine to check a value on everyframe, but you could be cleaner by not everytime set the mass.

you should set the mass once when the player jumps, then watch for when the velocity will indicated a call, and only then edit the mass, and exit this check until the next jump.

Bye,

Jean