Internal space ship gravity (Unity3d)

Started by
4 comments, last by ferrous 8 years, 6 months ago

Hello to everyone!

I have some problems with internal ship gravity in my unity3d game. I have a ship that can move in all directions and also rotate.

And I have a game object with character controller which represensts my FP Character.

How do I properly calculate gravity for my character?

I've tried to use rigidBody.AddForce(), but there is a problem with friction - when my ship rotating, after a few seconds character start sliding.

Does anybody know how to calculate gravity like in Pulsar: Lost Colony game?

Thanks in advance,

Denis.

Advertisement

Hmm, that sounds like you're doing things okay, have you tried bumping the solver iteration count on your player to see if you get better stability? (I'd try bumping it to something ridiculous high first, to see if it even solves the problem)

Hmm, that sounds like you're doing things okay, have you tried bumping the solver iteration count on your player to see if you get better stability? (I'd try bumping it to something ridiculous high first, to see if it even solves the problem)

Thank you for your response!

But I have a little misunderstanding =) Could you explain what do you mean here: "have you tried bumping the solver iteration count on your player to see if you get better stability"?

Thanks in advance,

Denis

If I understand you correctly, your gravity works while ship is not rotating? So WHILE the ship rotates, theres issues, but when it stops, everything is ok?

If so, could the sliding be because the rotation causes the character to accelerate, so theres actually two forces, gravity and acceleration because of centrifugal pseudoforces (or whatever they call them)?

In that case, try:

1. Increase friction between floor and character - you cant slide if friction is high enough (assuming the physics work correctly and its not some glitch)

2. Dont accelerate the ship too fast (even angular acceleration is acceleration)

3. Design the ship to minimize such additional forces (dont make ship long on an axis where it rotates fast)

4. Separate the ship-internal physics completely from the external physics AKA cheat. Like if a player enters a ship, spawn them in a stationary "ship internals" world that has not much to do with the actual ship doing crazy 30 g manoeuvres while you chill there. How to accomplish this depends on your tools.

If this is a physics glitch instead of a natural consequence of rotating the ship too fast, then you might want to read on known issues with whatever you are using, or how they work, to figure out why its happening.

o3o

If I understand you correctly, your gravity works while ship is not rotating? So WHILE the ship rotates, theres issues, but when it stops, everything is ok?

If so, could the sliding be because the rotation causes the character to accelerate, so theres actually two forces, gravity and acceleration because of centrifugal pseudoforces (or whatever they call them)?

In that case, try:

1. Increase friction between floor and character - you cant slide if friction is high enough (assuming the physics work correctly and its not some glitch)

2. Dont accelerate the ship too fast (even angular acceleration is acceleration)

3. Design the ship to minimize such additional forces (dont make ship long on an axis where it rotates fast)

4. Separate the ship-internal physics completely from the external physics AKA cheat. Like if a player enters a ship, spawn them in a stationary "ship internals" world that has not much to do with the actual ship doing crazy 30 g manoeuvres while you chill there. How to accomplish this depends on your tools.

If this is a physics glitch instead of a natural consequence of rotating the ship too fast, then you might want to read on known issues with whatever you are using, or how they work, to figure out why its happening.

Thanks a lot, I will try!

Much appreciate!

Hmm, that sounds like you're doing things okay, have you tried bumping the solver iteration count on your player to see if you get better stability? (I'd try bumping it to something ridiculous high first, to see if it even solves the problem)

Thank you for your response!

But I have a little misunderstanding =) Could you explain what do you mean here: "have you tried bumping the solver iteration count on your player to see if you get better stability"?

Thanks in advance,

Denis

http://docs.unity3d.com/ScriptReference/Rigidbody-solverIterationCount.html

It might not make a difference, but it's pretty easy to tweak and test =)

This topic is closed to new replies.

Advertisement