User Tag List

Results 1 to 10 of 10

Thread: [Phizix] Test if a body is not moving

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Phizix] Test if a body is not moving

    Hello,
    I have a few bodies moving and I want to test if a body stops moving. How would you do it ?
    I think of making a fastloop, select each (body from ID 0 to "number of bodies") and to test the Xvelocity and Yvelocity of each body. But I just need to test a special kind of bodies, not all of them.
    Would somebody have a smater suggestion ?
    Thanks in advance

  2. #2
    No Products Registered

    Join Date
    Feb 2007
    Location
    Sydney, Australia
    Posts
    1,654
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    A fast loop? Just use the condition compare 2 general values.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    I think it's impossible, Dynamite, because you have to give the ID of the body you want to test. You can't write as a condition "XVelocity=0", you must write "XVelocity (IDbody)=0".
    Thanks anyway...

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    I can't come up with a better suggestion. You'll have to loop through them, but if you're both adding and removing bodies in your game, the body ID's might not be ranging from 0-9 just because the body count is 10. By that reason, you might usually want to loop through the objects that is used to graphically display the physical bodies, and get the physical ID's from them.

  5. #5
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    Thanks, I didn't think of the adding and removing bodies problem : it's sure I'll loose the amount of the IDs. Your suggestion is good (but it appears to be more difficult than I thought :eek: )...

  6. #6
    No Products Registered

    Join Date
    Jul 2006
    Location
    Umeå, Sweden
    Posts
    1,090
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    When a body is created, attach an active to it and set one of it's values to the last created body id.

    Then you can loop through the actives, and check the speeds of each body.

  7. #7
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    Yes, Daniel, I think that's the best way to do it. Thank you.

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    Well, I don't know what I miss but it seems difficult to get a XVelocity and a YVelocity equal to 0. They always seem to be 3 or more... But I must check again...

  9. #9
    No Products Registered

    Join Date
    Jul 2006
    Location
    Umeå, Sweden
    Posts
    1,090
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    They are rarely 0, but check em like this... Set a limit to where the object is considered still enough... Then when both x and y velocity are below the limit add 1 to another value... (reset it if one the velocities goes above that limit).. Then if that value goes above, say 50 (approx 1 sec of non movement).. trigger your action

  10. #10
    Clicker Multimedia Fusion 2

    Join Date
    Jul 2006
    Location
    Near Nantes (Brittany)
    Posts
    241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Phizix] Test if a body is not moving

    Thank you, Daniel, I'll do as you said.

Similar Threads

  1. Game lags when moving (In use: HWA, Phizix engine)
    By iamjot in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 6th February 2010, 10:55 AM
  2. Phizix - dragging the body help
    By Cronn in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 24th September 2009, 08:06 AM
  3. Phizix: Multiple Lines in Body
    By Jaffob in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 12th November 2008, 09:21 AM
  4. Phizix- Anyway to get a "body" to collide with....
    By xhedgehogx in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st February 2008, 06:11 PM
  5. [Phizix] Body position
    By Surmulot in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th December 2007, 04:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •