# SOLVED[HELP]Perfect collision problem

#### yvodlyn

##### Member
Hi everyone,
Can someone help me with this issue? I want to create a perfect collision for a bouncing player. However the collision do not reach the floor before bouncing. The player bounce 14px before it reach the floor.

Create Event object player
Code:
``````vspd = 0; //vertical speed
vspd_jump = -14; //vertical speed for jumping
vspd_max = 14; //max vertical speed
grv = 0.4;  //gravity``````
Step event object player
Code:
``vspd += grv;``
GML:
``````//vertical collision
if (place_meeting(x,y+vspd,o_solid)){
while (!place_meeting(x,y+sign(vspd),o_solid)){
y += sign(vspd);
}
vspd = vspd_jump;
}
y += vspd;``````
Thank you!!!!

#### curato

##### Member
do you have the origin of the sprite set to bottom middle?

#### yvodlyn

##### Member
do you have the origin of the sprite set to bottom middle?
It is set to the center middle

The perfect pixel collision work without bounce system

#### Nidoking

##### Member
So you're moving to the point of vertical collision, and then... immediately setting the speed to -14 and jumping 14 pixels up. That's exactly what you told it to do. The general procedure if you want to stop upon hitting the ground is to stop upon hitting the ground. Stopping is speed 0.

#### yvodlyn

##### Member
So you're moving to the point of vertical collision, and then... immediately setting the speed to -14 and jumping 14 pixels up. That's exactly what you told it to do. The general procedure if you want to stop upon hitting the ground is to stop upon hitting the ground. Stopping is speed 0.
So if I understand, in my vertical collision code, I need to check if the player is on the ground( vspd to 0). So if the player is on the ground, I would be able to set vspd to vspd_jump?

#### yvodlyn

##### Member
I added that and it work fine! Perfect pixel bouncing colision!!!!
GML:
``````//calc current status
onground = place_meeting(x,y+1,o_solid);
if (onground) {
jumpbuffer = 6;
vspd = vspd_jump;
}``````