playMaker

Author Topic: Check rigid body position  (Read 1816 times)

devis.rossini

  • Playmaker Newbie
  • *
  • Posts: 18
Check rigid body position
« on: July 31, 2015, 10:29:14 AM »
Hi,

In my FSM I have to compute every frame the distance between a rigidbody's position and a given target.

If this distance is equal or greater to the distance of the previous frame, I must trigger an event.

How can I do that? I must wait to the physics update in order to re-compute distance and comprare it with the old one.

Devis

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Check rigid body position
« Reply #1 on: July 31, 2015, 02:56:24 PM »
Hi,
if you get the distance in a float you can use a float compare

devis.rossini

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Check rigid body position
« Reply #2 on: August 01, 2015, 02:40:57 PM »
Yes, but the position is not updated every ::Update(). I should check it during ::FixedUpdate()...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Check rigid body position
« Reply #3 on: August 01, 2015, 02:53:57 PM »
Hi,
there is a custom action on the Ecosystem called "RigidbodyTranslatePosition" that seems to work with FixedUpdate.