GameSalad

Can anyone tell me how to make a black hole gravity?

WeiyuWeiyu Posts: 175Member, PRO

Hello everyone !
I want to make a gravity such as black hole.

Something will sucked down and destroy when anything close to black hole.

Who can tell me how to make a black hole such as I said, please><"

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,895Member
    edited May 2016

    There are a ton of ways you could do it. It all depends on how far away from the black hole you want the gravity to start. You could use when an actor overlaps and collides with the outer edge of the black hole actor or use a magnitude function to determine how close an actor is to the black hole and set a distance the pull begins. Feed the position X and Y of the black hole out to two real game attributes and those will be fed into the actor that needs to move into the black hole.

    Do a forum search for determining distance between actors.

    magnitude (Function): Finds the length of a line segment drawn directly from the origin 0,0 to the given point.

    You can also include an offset to find the length between two points – for example, magnitude(x-x’,y-y’).

    If you have one actor at 100, 240 and another at 25, 30, you can find the distance between them with magnitude(25-100,30-240).

Sign In or Register to comment.