Object needs to collide with background wall when thrown

I have an object, let's say a bottle, that's being thrown at a moving target. There is a wall behind the target that I want the bottle to hit and break on if it misses the target, instead of continuing off the screen. However, I can't figure out how to make this happen. I've tried using invisible blocks where once the bottle overlaps with the blocks it breaks, but then it only breaks on the bottom block (they are layered up the screen over the wall object). I've tried tracking the y velocity and creating a range that the bottle would break at but then it would break right when it was thrown.

Any suggestions? The device orientation is portrait, if that matters, and the bottle is just being thrown at the target by a flick motion.

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    edited February 2013
    You just need a "overlap or collide" rule inside the bottle actor that says - when actor "overlaps or collides" with "Wall" - Destroy this actor. And include whatever animations or sounds, if any, that you want to trigger when the bottle breaks, in that rule as well.
  • huppertatorhuppertator Member Posts: 34
    That's what I'm already doing. Right when the bottle hits the bottom of the wall it breaks. Using this idea never allows the bottle to go any further than the first point it overlaps on the wall. I need the bottle to have the ability to actually hit the target while at the same time breaking on the wall if it doesn't hit the target and not just float across and off the screen.
  • huppertatorhuppertator Member Posts: 34
    Maybe by the size of the bottle? It shrinks as it goes towards the wall to create a 3-d effect. But the rate it shrinks depends on its velocity. So if it's moving slower it looks like it's going further away but when it moves faster it looks like it didn't go very far...

    I'm going to try this.
  • JarrenHJarrenH Member Posts: 206
    Are you using interpolate to shrink the bottle? Collide behaviors get canceled out while interpolating.
  • huppertatorhuppertator Member Posts: 34
    No. I'm using change size. timer -> for 0.5 seconds -> change size by -0.5
    The only problem is when to gauge a shatter on the wall. I'm using a form of @tshirtbooth 's ball throwing template for throwing the bottle, I'm just not sure how to track the bottle to determine when it is "hitting" the wall.
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    I think you're going to want a rule that says when the bottles width and/or height are lessthan or equal to x then trigger breaking. This way, regardless of the velocity, it's always going to break at the same size (giving it the appearance of breaking at the same distance). I think you just have to toy with the size value to make it look right.
  • huppertatorhuppertator Member Posts: 34
    That could work. I will try it out and report back.
Sign In or Register to comment.