# Problem with gravity and collision

Hi guys. I’ve a problem with appling gravity.

I have a plan that moves with the sensor(of acceleration) of the iPhone, and a ball that roll over this plane. The control of this plane is setted on kinematicMode so i cant apply forces and torque. I rotate it with the setlocalrotation.The problem is that, when the plan go up the ball jumps far, and when the floor go down the ball detaches from it and takes a little time to get back on the floor.

So i try to set the gravity of the physycsSpace(first) and of the ball(to an high value, such as vector3f().UNITY_Y.mult(500) ) but i’ve another problem. The Ball became uncontrollable and sometimes it fall down such as the floor have an hole

Have some idea to solve this problem?

the the behavior that I want is that when i rotate the floor the balls remains “glued” on the floor but continues to have the usual behavior of a physical object.

Thx to all!

Just care for realistic size and mass relations.

Don’t move the floor physically, change the gravity direction and tilt the cam.

EmpirePhoenix said:
Don't move the floor physically, change the gravity direction and tilt the cam.

tilt the cam is not reallistic. The skybox is motionless and the tilt of the cam is notable! I've to attach to the ball a chaseCamera.
But i try it now! :)

normen said:
Just care for realistic size and mass relations.

The the the behavior that I want is not realistic, and i've tried a very very very high number of combination of mass and gravity :(

(for exemple) i've tried to set the Y location of the ball when the floor go down but the result is that the ball slide on the floor.

With realistic size raising the mass just a bit should be enough, also never move or rotate non-kinematic objects wit setPhysicsLocation/Rotation if you expect collisions during that.

normen said:
With realistic size raising the mass just a bit should be enough, also never move or rotate non-kinematic objects wit setPhysicsLocation/Rotation if you expect collisions during that.

For size u intend the size of the floor(width and height)? i tried to set the mass of the ball to different values but nothing change....
i never move or rotate the floor (that is kinematic) with setPhysicRotation, i use setLocalRotation(i read it on the tutorial):)
i think that the problem is here..... but i cant see the solution :(
. The intesity of the kinematic's effect against other objects depends on their speed and mass: Ekin = mass * speed^2

1 unit = 1 meter, I guess your world is huge and your ball at least one meter in diameter.

My balls have this dimension

public static final float dimPlayer = 3f;

thee world is a matrix of quad of dimension : public static final int dimBloccoTerreno = 24; i have three type of floor 88 , 1616, and 24*24.

the floor is really bigger than ball…

Alright, I didn’t really want to know about your balls dimension but anyway ^^ 3 meters is like a huuuuuuge ball, no wonder it takes its time until it starts to move when the floor is removed under it at probably 100m/s…

Edit: Oh and probably you only gave it a weight of “1”, which means you have a huge beach ball… So the “slow” falling is realistic.

normen said:
Alright, I didn't really want to know about your balls dimension but anyway ^^ 3 meters is like a huuuuuuge ball, no wonder it takes its time until it starts to move when the floor is removed under it at probably 100m/s..

Edit: Oh and probably you only gave it a weight of "1", which means you have a huge beach ball.. So the "slow" falling is realistic.

now i try with a smaller dimension and more weight.

i make a little iron ball!