[PHYSICS] Gravity/antigravity

Get help using Construct 2

Post » Thu Sep 01, 2016 9:43 am

Hello,

How I can simulate gravity attraction or inverse on a object by many planets, depending by her mass :
Image

I have tried the rex gravitation plugin (behavior-gravitation-for-physics-behavior_t70521) but I can't do antigravitation (negative force) and Yann algorithm (black-hole-physics_t66424?start=10) but I can't do many planets.
Current event with rex gravitation plugin :
Image
The object is the BluePlanet and planets are GreenPlanet.

Thanks in advance.
Last edited by iyenal222 on Sat Sep 03, 2016 8:19 am, edited 2 times in total.
Image
B
6
S
2
Posts: 42
Reputation: 538

Post » Thu Sep 01, 2016 12:02 pm

I've made something like that one time. It's not a true solar system cause it's no using any physics behavior.
Create three object : A sun , a planet and a mouse object.
Add a behavior for the planet : bullet
Now in the event sheet create a variable named "Attraction"
We always need to set the planet perpendicular to the sun :
Every ticks :
planet set angle to Sun.X Sun.Y
planet rotate 90 degrees conter-clockwise

You can change the gravity by adding a "-Attraction" beside the 90 :
planet rotate 90-Attraction degrees conter-clockwise

You can add a event to change the attraction in game
On mouse wheel down : substracte 0.1 to Attraction
On mouse wheel up : add 0.1 to Attraction

You can create different planet with different size.

I know it 's like a fake solar system but i havent better.
Maybe some expert will come soon to give you a better soluce (scirra have a good community :)

Sorry for my english, i'm french so i wonder you will understand me x)
B
11
S
3
Posts: 25
Reputation: 1,095

Post » Thu Sep 01, 2016 12:51 pm

The problem is that my object isn't static, the object have an force on it, I want that the object path being affected by the planets attraction. Thanks anyway !
Image
B
6
S
2
Posts: 42
Reputation: 538

Post » Sat Sep 03, 2016 8:21 am

Current event added.
Image
B
6
S
2
Posts: 42
Reputation: 538


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest