Physics - Collision Response in one dimensional case:

image by conservation of energy: image * image + image * image = image* image + image* image

image by conservation of momentum: image* image + image* image = image* image + image* image

We want to find the final velocities (image and image) so there are 2 unknowns and 2 equations, so we can solve:

from 1 we get: image * image+ image - image* image = image

from 2 we get: image* image + image - image* image = image

combining we get

imageimage* image + image= image* image+ imageimage = image* image + image - image* image

image*image + 2*image*image*image - 2*image*image*image -2*image * image* image + image * image = image*image - image

image * (image + 1) + image * (2*image*image-2*image * image) + image*image - image*image = 0

so to get image all we have to do is solve quadratic equation where:

a = image + 1

b = 2*image*image-2*image * image

c = image*(image-image)

image = image

= -2*image*image-2*image * image +- sqrt (image2*image*image-2*image * imageimage-4(image + 1)*image*(image-image)

-----------------------------------------------------------------------------

2*(image + 1)

Here I'm stuck, if you have any ideas how to take this forward please let me know.

back to collisions


metadata block
see also:

 

Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Physics for Game Developers - Assumes a knowledge of vectors, Matrix and trigonometry (the book has a one page introduction to quatnions). The book introduces Newtons laws but it does assume a basic knowledge physics. It covers Kinematics, Force, Kinetics, Collision (detection), Projectiles, Aircraft, Ships, Hovercraft, Cars, Real-time, 2D rigid body, Collision Response, Rigid body rotation, 3D rigid body, multiple bodies in 3D and particles. (I cant find a general formula for collision response which combines linear and rotation, but there may be something in the code included?). If you don't have the prerequisite knowledge of Matrices etc. you may want to get the Mathematics for 3D Game programming book first.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

cover Dark Basic Professional Edition - It is better to get this professional edition

cover This is a version of basic designed for building games, for example to rotate a cube you might do the following:
make object cube 1,100
for x=1 to 360
rotate object 1,x,x,0
next x

cover Game Programming with Darkbasic - book for above software

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.