Originally Posted By: Kartoffel
from what I can see, the code is correct and it behaves the way it should?
After some tests I guess it does.. but it just doesn't fit my expectations :<

Originally Posted By: txesmi
Who knows...
Damn... Thank you txesmi, and yes... thanks to your code, I can see that bounce get's fucked up when box hits the edge..

Another thing that I noticed, that it bounces off the surface different amount of time.. with fps 60 - 5 times, 20 - 6 times... If I lower fps while it's already bouncing, then it will cause to bounce off 7 times..

That sliding bounce effect was fixed by calculating bounce manually:
Code:
function get_bounce(VECTOR *speed, VECTOR *bounce_vec){
	
	VECTOR temp_inverse;
	vec_set(&temp_inverse, speed);
	vec_inverse(&temp_inverse);
	
	bounce_vec->x = speed->x + 2 * vec_dot(&normal, &temp_inverse) * normal.x;
	bounce_vec->y = speed->y + 2 * vec_dot(&normal, &temp_inverse) * normal.y;
	bounce_vec->z = speed->z + 2 * vec_dot(&normal, &temp_inverse) * normal.z;
	
}



Best regards! Thank you for your time guys.


Edit:
Originally Posted By: Ezzett
I think you need to implement a fourth order Runge-Kutta method to get correct results with large time_steps.

Or just dive into the world of game physics literature that can drive you crazy grin (it depends on the knowledge you already have)

https://www.amazon.com/gp/aw/d/012381976...&ref=plSrch
Thank you for the link! I'll take a look at it.

Last edited by 3run; 04/18/18 14:35.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung