How do you destroy an actor only when it collides at a certain velocity?

Hi everyone, I'm trying to figure out how to destroy an actor when it collides with a wall but only at a certain velocity. If it doesn't reach that minimum velocity it just collides but doesn't get destroyed. Thanks!

Comments

  • LovejoyLovejoy Member Posts: 2,078

    actor collides with wall

    rule

    when actor overlaps or collides with wall

    when attribute self.motion.linear velocity x is > 400

    destroy actor


    change the 400 to whatever value you want and the liner velocity to x or y depending on direction.

    Fortuna Infortuna Forti Una

  • AtomicFXAtomicFX Member Posts: 23
    edited October 2014

    @raycur09 said:
    actor collides with wall

    rule

    when actor overlaps or collides with wall

    when attribute self.motion.linear velocity x is > 400

    destroy actor


    change the 400 to whatever value you want and the liner velocity to x or y depending on direction.

    Thanks for the reply but I am currently using Accelerate to move my actor and the actor's velocity doesn't seem to be affected by it. I'd like to keep using it as it makes the movement more realistic (the movement is of the actor falling). Any other way?

  • LovejoyLovejoy Member Posts: 2,078

    @AtomicFX said:
    Thanks for the reply but I am currently using Accelerate to move my actor and the actor's velocity doesn't seem to be affected by it. I'd like to keep using it as it makes the movement more realistic (the movement is of the actor falling). Any other way?

    Same concept, just remember since the object is going down its going in a negative number. so instead do self.motion y < -400 destroy otherwise collide

    Fortuna Infortuna Forti Una

  • AtomicFXAtomicFX Member Posts: 23

    That worked great! I didn't realize since it's dropping it's actually a negative number. Thanks!!

  • LovejoyLovejoy Member Posts: 2,078

    @AtomicFX said:
    That worked great! I didn't realize since it's dropping it's actually a negative number. Thanks!!

    No problem.

    Fortuna Infortuna Forti Una

  • LovejoyLovejoy Member Posts: 2,078

    @AtomicFX said:
    That worked great! I didn't realize since it's dropping it's actually a negative number. Thanks!!

    No problem.

    Fortuna Infortuna Forti Una

Sign In or Register to comment.