problem, it isn't stick to the planet.

Hi, this question is clear:

How to get my character to “stick” to the planet?

Because when I apply a speed, my character leaves the planet.

Actually i am using a force called “Gravity” of “9.8”, but it doesn’t work, because it leaves the planet.

thanks!..

Several possible solutions -
Set your character’s rigidbody to use gravity.
Set your character’s to not be isKinematic.
Remove the line(s) in the script(s) that is(are) applying incorrect forces/movement to the character.

hey, hi, i can not use gravity, because the gravity should go to direction on the feet of my character. Remember than i am creating a deform planet with a raycast (ray) than returns the “normal” vector of hit zone.

i am sure than uncheck the “isKinematic” property.

i am using one force, it is the gravity for deform planet.

thanks.!

only i need know:

How to get my character to “stick” to the planet?

thanks!.-

How about AddForce as a vector from your character to the centre of the planet, rather than raycast.

The problem is that it only works on circular planets, however, I have irregular planets (deformed), then I find it impossible to do what you say.

thanks!.

gravityForce = (planetCenter.position - player.position).normalized * 9.81 * Time.deltaTime;

If your planet doesn’t have a single center point then you need to represent its “spine” with a spline and find the closest spline point to the player, then pretend that point is the planet center and still use that same equation. There are some very nice spline examples in the forum here (search for B-Spline or Bezier Curves), and Google returns plenty of hits for “closest point on a spline”

How irregular are they? Even if they’re roughly spherical tha force to an approximate centre will stick you to it. If you want to align to the bumpy surface get the hit.normal from the collider.

If they’re not even spherical, then might have to do something more like I did in a quick prototype.
http://steamrolled-media.net46.net/unity/tilted/Tilted000.html
(uses the vector3 from hit.normal for gravity + jump)

planet when I say irregular, I mean deformed planets, like this:

I already know how to create hit.normal, I just need to “stick” to the planet, nothing more.

recently holds a gravity of 9.8 that goes to the feet of my character, but not strong enough to “stick” to the planet.

and that if I apply a higher speed, it leaves the planet, losing the vector that targets the planet.

I can not use a central point, because if you leave the planet, it will move toward the center and not where it really was.

I can’t see anywhere in that picture where local gravity would change.

If your objects are achieving escape velocity, just add more force.

yes, but, while more force, less speed will be.

ok,other example:

For a cylinder, you use a line that represents its center and draw the character towards the nearest point on that line. Don’t let them escape. Always draw them towards the nearest point on the line. If they’re able to pick up enough speed to leave the planet then you need to increase the gravity force until they can no longer escape.

thanks, but I have deform planets, the video is an example.

but many thanks to everyone for help.!