Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

We are trying to implement a minigame where the player character sits on a bouncing ball, and needs to a) hit forward to move forward and b) hit left/right to adjust against the the ball's natural wobble (in other words, if the ball leans left, you must hit right).

We have tried implementing this by setting the bounciness and weight on the ball so that it bounces naturally when the player is not on it, then fixing the player model to the ball (in other words, treating them as a single unit), then having the CharacterController control the unit while it continues bouncing.

However, no matter how we tune the various factors (bounciness, weight, input multiplier, gravity), the ball remains quite sensitive and eventually spirals out of control. We would particularly like to allow the player some opportunity to regain control.

I have played a number of games that require some kind of reflex-based wobble/balance mechanic. Is there a general approach here that we are missing?

This question is for a small academic project, so we're wondering if there's a specific component we need, or part of the Physics engine we've missed, or technique we should look up - but please don't post code. There are no project requirements here except using Unity 3D (e.g. the assignment is not "implement a bouncing ball minigame").

share|improve this question
1  
Not sure if this will work as a plain physics system. What you might need to do is combine player and ball into an inverted pendulum system which, if necessary, breaks under certain conditions. If there is no time where player and ball will be separate, you might as well simulate them together. en.wikipedia.org/wiki/Inverted_pendulum –  jzx Jul 29 at 19:59
1  
Maybe this will help illustrate my point: in the Tony Hawk games, a manual isn't simulated as player+board+ground. It's just player+ground, with the player in a special state that tracks "balance," possibly as an imaginary tangent vector or something. –  jzx Jul 29 at 20:03
    
@jzx we are treating them as a single object (I've clarified the question to make that clearer) - I think that link might be exactly what we're looking for! please post the inverted pendulum + imaginary balance approach as an answer and if it works for us I'll accept it! thanks for your insights –  d3vid Jul 30 at 7:08

1 Answer 1

What you seem to have is a double pendulum which is inverted.

Figure 1

Here, m2 is the player's center of mass. In order to remain in balance, L2 cannot be tangent to the ball (they would slip off) and m2 must remain nearly above f (otherwise they'd fall over). Obviously this would be complicated to manage in a game where you can't feel how you're balancing.

A simpler method is use a single leg pendulum and imagine where the player needs to direct their center of mass in order to move in that direction. To go forward, they need to shift their weight forward to stay on the ball. To stop going forward, they need to shift their weight back, otherwise their center of mass will keep going that way until they slip off.

Figure 2

I've used forward/backward momentum here since it's easier to describe, but the same principle applies to lateral movement and turning. In order to turn, they need to shift their weight counter to the direction of the turn while moving forward or backward.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.