We’re prototyping a Marble-like game: you control a ball that rolls around on the scene.
We want to make it with physics, the idea is you would press up/down to accelerate and left/right to turn (or tilt if you prefer). Also, the ball can grow/shrink when you pick powerups.
So I’ve started with a sphere, a rigidbody, and I’m just adding torque to make it roll.
After a lot of tuning I came up with some values that feel about right… but when I start changing the scale, everything collapses, the ball feels sluggish, it’s terrible.
So… this raising lots of questions.
I don’t really understand how scale affects the body… is there a way around it? like changing the mass along with the scale?
How about I move the vertex themselves instead of scaling the transform? Would that change anything? Will the physics engine be able to follow on a modified mesh?
I have a hard time tuning, figuring out how such variable affects the ball. For example the angular drag makes the ball quite slow, I have to raise maxAngularVelocity. Should I make my own drag?
When I move the ball slowly, it feels about right, but when it accelerates, it spins like crazy, like it’s on ice… why???
Should I move the ball using AddForce instead of AddTorque, and control its rotation some other way?
… ultimately, is using physics for a this game a good idea?
If anyone has ever done a marble game before, I’m dying for suggestions!
Well, I’m not the expert you were looking for…
but until they get there, you should know this:
Scale can always cause problems.
Seriously. Every game engine I’ve ever used was the same way. You’d find the numbers you liked and then tinker with the scale and the math would go all weird.
Now as a general rule, I NEVER scale in an engine.
But… Depending on how the physics work…
If you’re using a meshcollider, try using a spherecollider, or vice versa if the opposite is true. I would think that a meshcollider would cause problems if you scale it, but I could be wrong. I hope this helps.
Thanks! I have no experience with other engines so good to have some input.
I’d say that’s a bit extreme… on our last game, I scale the characters when they get powerups (become dwarfs or giants) and have had no problem at all.
It’s only when physics come in that it becomes a problem… but if it’s part of your gameplay, what are you gonna do? There has to be a way to solve this situation.
OK, while looking for a solution to another problem, I stumbled upon the excellent hole-in-terrain example from Yoggy, and guess what… he’s rolling a marble in his terrain !
The behaviour of his marble isn’t what I’m looking for, but still better.
From what I see, he’s using a custom physic material, with lots of friction. Unfortunately, his marble doesn’t roll down hills (or poorly), but that could be because he locks the rotation (reverse torque) if the user isn’t moving the ball.
So that gives me pointer to fix the “spin feel” of my marble… I’m still looking about the whole scaling thing.
BTW I should mention that the gamedesign so far plans for a scaling ratio (max scale/min scale) of about 10, so definitely significant enough to break the physics.