#Planetary Gravity Question

1 messages · Page 1 of 1 (latest)

simple ridge
#

Without any code, its hard to tell what is going wrong. Also how you set it up and what you want to achieve. Is it using gravity, are you controlling the rotation manually and so on. especially if you ask, if its your planet code, but no code is there 😉

plush garnet
#

just thought that maybe this was a common issue with making gravity like this, ill add some code snipps

simple ridge
#

It depends on what your gravity is. are you using the defaul tgravity? That wont work because its always down on y axis.

plush garnet
#

this is my planetaryGravity code:

{
    public static List<PlanetaryGravity> AllPlanets = new List<PlanetaryGravity>();

    [SerializeField] private float gravity = 9.8f;

    public float Gravity => gravity;

    void Awake()
    {
        if (!AllPlanets.Contains(this))
            AllPlanets.Add(this);
    }

    void OnDestroy()
    {
        AllPlanets.Remove(this);
    }

    public Vector3 GetGravityDirection(Vector3 position)
    {
        return (transform.position - position).normalized;
    }
}```

and then the txt file is for every object affected by the gravity, i use a player controller package which is linked to the invector reference, and ive followed multiple tutorials for the gravity
simple ridge
#

!code please, not just a huge text file

nova thicketBOT
simple ridge
#

And I dont know what player controller package is.

plush garnet
#

you dont really need the player controller, just that the invector reference references the player controller.

simple ridge
#

Just from seeing the video, I assume, your character is not pointing towards the center of mass of the planet, right? And without a first prototype of just achieving this, adding more packages wont help you debug it.

plush garnet
#

i had this working with a capsule, and eventually a tposing model in a different project, migrated it into a new one, and added animations to get this result

simple ridge
#

So the animations might be the issue? Are they overwriting the rotation of your gameobject?

ember tiger
#

Animations can do that. Got to be careful when adding animations to custom physics.