Trajectory change after collision

Post Reply
User avatar
deivith3d
Posts: 6
Joined: Thu May 30, 2013 7:08 pm

Trajectory change after collision

Post by deivith3d »

what are the functions responsible for determining the trajectory of objects when they collide with others?
I would like to know the trajectory of an object due to its shape , speed, angle , etc ...
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Trajectory change after collision

Post by drleviathan »

It is impossible to answer your question because it is too vague and the details of the "functions responsible for collisions" are too complex. Perhaps you could elaborate on what you really want to do? You want to know the trajectory of an object... so you can what?
User avatar
deivith3d
Posts: 6
Joined: Thu May 30, 2013 7:08 pm

Re: Trajectory change after collision

Post by deivith3d »

I would like to know the trajectory of two objects after the impact of the collision.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Trajectory change after collision

Post by Basroil »

deivith3d wrote:I would like to know the trajectory of two objects after the impact of the collision.
That's like asking "where would the arm angles be after 5s if I put a double pendulum in motion?", the answer is "depends on the absolute conditions, any little change will give you a different outcome". If you're so interested in figuring it out, just step your simulation and record the data, there is literally no other way for anyone to explain without knowing all of the system start conditions ! (and even then it might be off a bit if you have any user input).

I would seriously suggest you read a primer on basic kinematic and dynamics if the question is not just poorly worded and you were actually asking "how can I read the resultant velocities and impulses from a collision manifold". Unfortunately the questions (both) as they stand are far too vaguely worded.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Trajectory change after collision

Post by drleviathan »

Maybe you want to know the velocity of the object immediately after a collision? (just guessing here)

If so you would have to implement your own code to detect collision events since Bullet doesn't provide a collision callback system. There some example code for how to do this in this thread.

After a collision event is detected you could then call btRigidBody::getLinearVelocity().
User avatar
deivith3d
Posts: 6
Joined: Thu May 30, 2013 7:08 pm

Re: Trajectory change after collision

Post by deivith3d »

I think I'm unable to express myself correctly (my English is bad) ... after detected the collision, how the Bullet calculates the angle of the trajectory of the objects after the collision? How is the trajectory calculation shown in the image ... who does that?:
Attachments
impacto.gif
impacto.gif (2.96 KiB) Viewed 6535 times
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Trajectory change after collision

Post by drleviathan »

The answer to your question is complicated. There isn't a single function that takes input and produces output, but a pipeline of functions. The input into the final function that sets the velocity doesn't look anything like the input into the first function that takes it... unless you consider btDynamicsWorld::stepSimulation() as your function in which case the input is the state of all the objects and the output is the new updated state.

Inside the aforementioned pipeline are a lot of details that allow the physics simulation to compute approximate solutions to multiple simultaneous contacts -- ultimately it comes down to systems of equations which are solved with linear algebra approximations.

Note, btDynamicsWorld is a virtual base class that has several implementations -- as a developer you have a choice about which one you use in your simulation. Which one you choose depends on what exactly you are trying to do. The details of the simulation depends on which one you choose.

btDiscreteDynamicsWorld is the one that most people use. To get the answers you want you'll have to read the code, research topics on google, and study a lot of text books about game physics.
Post Reply