# [Physics] Impact Force

Get help using Construct 2

### » Fri Jul 26, 2013 11:37 pm

Hey,

I'm making something simple with the Physics behavior. If the object hits the ground at too high speed, it's destroyed. Code looks like this.

->On Object Collision with Ground
--->If Object Overall Velocity > 400 : Destroy Object.

The object always hits the ground with 500 Velocity.

In 50% of the cases, the object is destroyed on impact.
In 50% of the cases however, the object is NOT destroyed.

What I imagine is that sometimes, at the moment of collision the object's velocity gets reduced BEFORE the game can check for overall velocity on the next tick.

Any idea how to go around this inconsistency?

I suppose I can record the velocity in the last few ticks in an Array, like a black box, and check the last few entries from the moment before impact, but that seems quite cumbersome for a simple check.Xionor2013-07-27 00:03:45
B
10
S
3
Posts: 233
Reputation: 1,537

### » Sat Jul 27, 2013 12:02 am

The "Black Box" solution worked, but it's not really straightforward. Still looking for suggestions : )
B
10
S
3
Posts: 233
Reputation: 1,537

### » Sat Jul 27, 2013 1:37 am

I guess you could always compare position (Y coordinate) with ground instead of checking "on collision with ground".
B
12
S
3
G
3
Posts: 36
Reputation: 3,048

### » Sat Jul 27, 2013 9:58 am

I'm extremely tired right now so I'm not sure I understood your question. But if you store the physics objects velocity in a variable when it collides, then compare that variable a short amount of time after you can tell if the hit was just a small scrape on the side, or if it was a head-on collision.
B
48
S
15
G
7
Posts: 603
Reputation: 8,256

### » Sat Jul 27, 2013 10:46 am

[QUOTE=MakubeX] I guess you could always compare position (Y coordinate) with ground instead of checking "on collision with ground".[/QUOTE]

The center of the Y coordinate is in the Origin Point of the object, which is in the middle. Since both object and ground are solid objects, they never cross.

In addition, the ground has different heights.
B
10
S
3
Posts: 233
Reputation: 1,537