1 .- I am creating the gravity of planets like Mario Galaxy, it goes very well, but the problem is that I need to control gravity, I know that this will occupy the property "Drag " of of “RigidBody”, but How would be the equation?.
trooper : Do you need gravity to apply to every object or just your character?
I need to apply the gravity of each object, as it adapts to the planet that is irregular in shape.
tropper: Otherwise you may need to use ConstantForce on only your character’s game object.
Ok, thanks for your response, i will try make a piaggio with ConstantForce
EDIT.
I used this statement:
constantForce.force = transform.right * 9f;
[/ CODE]
with my own gravity (that I need to work on the misshapen planet):
[CODE]
Rigidbody r = this.rigidbody;
r.AddForce( transform.up * fauxGravity * r.mass );
[/ CODE]
but I do not work, it is pegad, no movement, I think it must be because I'm adding a downward force to abjo ...
---------------
does r.AddForce get used in the Update() function?
(AddForce will need to be called many times to make the object look like it’s receiving constant gravity)
Also check to make sure your rigidbody’s kinematic property is not checked.
....
void Update () {
AdjustToGravity(); // here a ray for extract the normal of the surface
Gravity(); //Here is the gravity simulation
constantForce.force = transform.right * 3f; //Here is the constantforce
}
private void Gravity(){
rigidbody.AddForce( transform.up * fauxGravity * r.mass );
}
....
I think it is gravity, and which exerts a downward force on a permanent basis, then to make another force (right) combine both forces causing the second force (ConstantForce) not take effect.
and that by applying a force majeure, that is:
constantForce.force = transform.right * 9f / / 9 for example.
Does constantForce.force = transform.right * 3f need to be specific direction. transform.right will mean that the gravity is always making the character go to his right as opposed to the right side of the world.