How do I create a magnetic field

Get help using Construct 2

Post » Tue Sep 18, 2012 8:25 pm

Hi,


I need to have all objects within a radius of a particular object need to get attracted to it..and move towards it.. like a big magnet.

Is there a inbuilt way to do that.
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
5
G
5
Posts: 391
Reputation: 5,577

Post » Tue Sep 18, 2012 8:59 pm

B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Wed Sep 19, 2012 8:41 pm

Nice. :D

R0J0hound .. could you point me to a reference for those forumlaes.. how did you arrive at it?
Krish
Hey! Did you know that you can hire me to make your games?

Click Here to See More
B
21
S
5
G
5
Posts: 391
Reputation: 5,577

Post » Wed Sep 19, 2012 9:22 pm

The force calculation is a simplification of gravitation.
http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation

So that gives the force, and the angle should be toward the magnet so I converted from polar (distance, angle) to caresian (x,y) so I could sum up the forces before applying them to the player.
http://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests