playMaker

Author Topic: Set Gameobject As Center Of Gravity  (Read 8079 times)

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Set Gameobject As Center Of Gravity
« on: January 02, 2016, 01:00:57 PM »
A bit of fun with creating fake gravity!!

I cannot explain how to use because it has many features. The filters works in this order useOverlapSphere(if on) then tag(if on) then layer(if on). Or tag then filter(if on). You should always have minimum tag on or useOverlapSphere on.

Attached are examples of what you can do at runtime by playing with the variables. (2 basic setups + 2 complex // link: http://giphy.com/gifs/l3nW2ILHGN8XlVzUY  &   http://giphy.com/gifs/l0GRk8bJQJ6NSF008) - most cubes had a mass of 1 and some of 10.

on ecosystem or https://snipt.net/dudebxl/

 ;D

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #1 on: August 21, 2016, 11:37:08 AM »
Hi, I have been unable to get this script to have any effect.  Is it still functional?  If so, how do I make it have an effect on my rigidbodies?  I have a rigidbody at the center of a planet set as gravity source but it has no effect on my other rigidbodies in the scene.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Gameobject As Center Of Gravity
« Reply #2 on: September 06, 2016, 11:13:25 AM »
I will check with PM 1.8.x + Unity 5 and let you know.

It works, just make sure they all have rigibodies and play with the settings, maybe increase the gravity force...
« Last Edit: September 28, 2016, 01:54:16 PM by dudebxl »

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #3 on: November 05, 2016, 08:31:50 AM »
OK, 2 month on and have yet to ever get this to have any effect whatsoever an any rigid body in any scene.... is there any chance of getting instructions on what all the settings actually mean?  I'm sure it's a great plugin but at present you are the only person who knows how to use it.... or maybe a sample scene with it working?


Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #4 on: November 05, 2016, 08:48:19 AM »
OK. so I've managed to get it to work in a completely fresh scene with small objects only, but still nothing when using a very large "planet" to attract small objects.  Is there a maximum distance from the rigidbidy that this will work? I've set the sphere size to include all the rigid bodies but nothing is happening to them.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Gameobject As Center Of Gravity
« Reply #5 on: November 05, 2016, 03:08:29 PM »
Mmmm let me think about it..

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #6 on: November 05, 2016, 05:55:14 PM »
breakthrough!  I needed to set the parent rigidbody to have a really, really massive mass.  Now it works.  I assumed it was a simulated force, not dependant on the mass of the "planet" body.

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #7 on: November 05, 2016, 06:16:10 PM »
OK, next issue... It looks like the gravity is having a much stronger effect on objects with a high mass compared to objects with a low mass which isn't how gravity works.  Gravitational pull should effect all objects exactly the same regardless of their mass.  Is there a setting to make it function like real gravity?

In short, the gravity should pull just as hard on a rigidbody of mass 1 as it does on a rigidbody of mass 100.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Set Gameobject As Center Of Gravity
« Reply #8 on: November 06, 2016, 03:10:08 AM »
It is more of a toy action: Can you attache a screen shot of the action stetting your are using so i can try to reproduce it on my side.

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Set Gameobject As Center Of Gravity
« Reply #9 on: November 06, 2016, 06:05:11 AM »
Ahh I see, I thought it was a gravity simulation, not attraction based on mass.

Now that I look at your links in the original post I see that it is happening in your examples.  The cubes with mass 10 in your example should move exactly the same as the cubes with mass 1.  The pull of gravity is identical on all objects regardless of their mass. 

I've found that if I launch a spacecraft away from a planet then turn off the thrust your gravity model will slow it down much quicker if it has a high mass... whereas any object should slow down at the same set rate.

This might be a flaw with unity possibly, not sure how realistic the default gravity is but I had thought force type "acceleration" ignored mass.

mrphilipjoel

  • Playmaker Newbie
  • *
  • Posts: 48
Re: Set Gameobject As Center Of Gravity
« Reply #10 on: January 21, 2020, 08:53:17 PM »
Is there a way to use an action to disable the gravity effect? I only want it to pull objects for either a certain time, or until the objects hit the ground prior to hitting the gravity object.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set Gameobject As Center Of Gravity
« Reply #11 on: January 23, 2020, 01:43:14 AM »
Hi,

 use the action "Use Gravity" on your object rigidbody to turn its effect on or off.

Bye,

 Jean