# Simulate a Repulsion [Solved]

Get help using Construct 2

### » Fri Apr 05, 2013 10:55 pm

Hello,

I'm doing a little test where I want simulate a repulsion, like a snooker ball shocking with another ball, and/or, a spaceship shocking with a hard spaceship.

The principle is simple, but I can't figure out the math, so, someone can help me, please?

I think this is something known by Mr. @Yann or a Guru of the Math =P

My last try was to compare the center position of the hit ball and the center position of the ball in movement, when one overlap the other ball, they will split the energy.

But how we can change their direction to the right direction? using cos and sen?

Another question, in case of a sprite with squared collision box, how it work?

Some images to illustrate the problem:

TELLES08082013-04-05 23:20:57
B
92
S
18
G
12
Posts: 1,166
Reputation: 18,090

### » Fri Apr 05, 2013 11:20 pm

Solved.

This is more simple than I was thinking, thanks to @Ashley sample template I figured out =P

Now it's just time to build the best collision system and repulsion.TELLES08082013-04-05 23:22:22
B
92
S
18
G
12
Posts: 1,166
Reputation: 18,090