I'm using the Roll-A-Ball script to have a ball roll around a small area and I am having two problems:
1) The ball is rolling around in a box made of flattened cubes. All but the bottom has mesh render removed so they can't be seen. Is there any reason why, when the tilt angle is too great, the ball gains enough momentum to launch out of this box?
2) I want to change the existing script so that when tilted, the ball has a set speed. I need the player to be able to switch directions quickly and this seems impossible as the physics (or accelerometer?) are causing the ball to just slow down and then eventually speed up again when tilt direction is changed.
I think if I could fix problem 1) then I could just increase force enough so that changing direction wouldn't take so long...
Here is the code example:
This is looking all funny on my screen, I think I've pressed something wrong trying to copy the code in..
Any help would be greatly appreciated ^_^
Turns out the that the walls used to enclose the ball were not thick enough to contain it.. Just a matter of increasing the thickness. :) This way, I don't have to restrict the ball to just the Y axis and don't need to slow down the fixedTimeStep.
This also allowed me to increase the balls movement speed enough to have the effect I wanted! Was a minor headache, but it's done now :) Thanks for the help above, also :)
answered Jul 21 '10 at 12:37 AM
To prevent object's from going through each other, you could just decrease the fixedTimeStep in the physics settings (Edit->ProjectSettings->Physics).
answered Jul 13 '10 at 06:55 PM