playMaker

Author Topic: Constant force towards another game object?  (Read 2226 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Constant force towards another game object?
« on: June 13, 2016, 11:55:49 AM »
I'm trying to set up a very basic spherical gravity where a game object is constantly pulled towards another.  I can't use the "circular gravity force" asset as it is not constant (it gets weaker the further you get from the origin).

Is there any way to set a force on a rigidbody object that pulls it towards another object? I'd like to specify the target and the amount of force in units.  It must be a physics force as I will be countering it with another directional force to create an orbit.

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Constant force towards another game object?
« Reply #1 on: June 13, 2016, 01:18:14 PM »
Have you tried https://snipt.net/dudebxl/setgameobjectascenterofgravity/

I posted a gif in this forum but i am on ipad so u need to search for it...

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Constant force towards another game object?
« Reply #2 on: June 13, 2016, 02:35:07 PM »
Great, I'll take a look!

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Constant force towards another game object?
« Reply #3 on: June 14, 2016, 03:53:21 PM »
I tried the script but I can't apply it to a game object, I just get "needs to derive from a monobehaviour"

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Constant force towards another game object?
« Reply #4 on: June 14, 2016, 04:54:37 PM »
Did you download it from ecosystem? It is an action...
« Last Edit: June 14, 2016, 04:57:47 PM by dudebxl »