I think I'm missing some basic knowledge

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
MashOMatic
Posts: 5
Joined: Fri Oct 14, 2011 1:59 am

I think I'm missing some basic knowledge

Post by MashOMatic »

Reading the forums, following along with the demos assumes some level of knowledge about physics engines.

I sort of get what is happening with a Rotation, Scale, Translation but I can't help but feel that I'm really missing some basic knowledge that everyone else seems to get! Can anyone point me at a reference, on-line course etc that might help me?

I've been able to setup my BEPU environment and put in my models etc but then I start run out of knowledge when I start manipulating entities, world transforms, collisions etc etc.

A pointer to a "3D Physics 101" would be much appreciated.

Ta
Mash!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: I think I'm missing some basic knowledge

Post by Norbo »

It sounds like the core issue is linear algebra. It's all about handling vectors and transformations.

Here's a couple of websites that cover linear algebra (and many, many other topics):
http://patrickjmt.com/
http://www.khanacademy.org/

You might notice that there's a massive number of lessons about it. You won't need to memorize every bit of the lessons to use a physics engine. The bits that are frequently used are a very tiny subset of what is categorized as linear algebra.
I've been able to setup my BEPU environment and put in my models etc but then I start run out of knowledge when I start manipulating entities, world transforms, collisions etc etc.
In general, a good starting point is to flip through the BEPUphysicsDemos and make changes to them. This allows you to rapidly test your hypotheses about how things work and get feedback really fast.

Things like:
-Make the WallDemo float away from the ground instead of towards it.
-Explode the wall without using the Explosion class by applying impulses or changing the entities' linear and angular velocities.
-Make the saw blade on the SawContraption demo bigger, make the arm longer, fiddle with masses in the blocks and see how it responds.
-Make an entity go around in a circle by controlling its velocity every frame.
And so on.

And of course, if you find yourself with a specific question, I can try to help. It can be difficult to create a specific question without having a pre-existing knowledge base, so sometimes the answers to questions will be a bit beyond the scope of a forum post. In these cases, I usually just try to help narrow down the issue into answerable and understandable pieces.
MashOMatic
Posts: 5
Joined: Fri Oct 14, 2011 1:59 am

Re: I think I'm missing some basic knowledge

Post by MashOMatic »

Thanks Norbo, I'll check out those links. There is a heap to learn.
Mash
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: I think I'm missing some basic knowledge

Post by Norbo »

I should belatedly add that, while those links go into great depth, a relatively shallow tool-level understanding of transformations, vectors, and other processes can go a very long way in game development and physics engine usage.

You don't need to be able to manually scribble a projection matrix in order to use a Matrix helper function to create one. If you understand the purpose of a projection matrix- to transform from view space into clip space- the numerical details are secondary. Understanding how the matrix and vectors form a system of equations is a nice aid in understanding how such things are constructed, but you don't need to get bogged down.

Here's a non-exhaustive list of helpful tools and tricks you might see repeatedly:
-Dot products. Are these vectors facing the same direction (dot product > 0)? What is the angle between these two normalized vectors (Math.Acos(dot product))? How fast is this object moving in normalized direction vector V (Vector3.Dot(V, entity.LinearVelocity))?

-Cross products. What is a vector in the direction perpendicular to vectors X and Y (Vector3.Cross(X,Y))? What's the area of this triangle with edge vectors X and Y (Vector3.Cross(X, Y).Length() / 2)? What is the normal of this triangle with edge vectors X and Y (Vector3.Normalize(Vector3.Cross(X, Y))? What is the angle between two normalized vectors (the dot product can do it too, but the cross product's version is slightly different in its domain and usage)? How does the order of cross product parameters affect the result (Vector3.Cross(X, Y) == -Vector3.Cross(Y, X))?

-Properties and identities associated with the dot and cross products can come in handy, particularly in optimization. The Scalar Triple Product is seen fairly regularly. Knowing how familiar scalar operations like multiplication interact with dot products is very helpful for intuiting correct behaviors. And many, many other little things.

-Projections and primitive geometric operations. Orthographically pushing points onto a plane (remove the component of the position along the plane's normal). Intersecting a ray and a plane. Distance between lines (it might appear at first like it requires minimizing with a pair of parametric equations, but the application of the cross and dot Tools makes it simple :)).

-Rotation matrices are orthonormal bases. They have up, down, left, right, forward, and backward vectors. You can use those vectors to rotate around an object's local X axis or move along an object's local Y axis and other fun stuff. The matrix's Up vector is the value you'd get if you transformed Vector3.Up by the rotation matrix, but the property can read it right out of the components of the matrix!

-The hierarchy of common transformations. Rotations, translations, combined rigid transformations, and less commonly scaling, shear, linear transformations in general, affine transformations (translation with linear transformation). The little tricks you can perform when you have guarantees about what a transformation is can simplify work quite a bit. For example, instead of inverting a pure rotation matrix as if it were a general matrix, transpose it!
MashOMatic
Posts: 5
Joined: Fri Oct 14, 2011 1:59 am

Re: I think I'm missing some basic knowledge

Post by MashOMatic »

Thanks Norbo for your extensive reply, I'm hoping to have some time tomorrow to play with it all. I've stripped back the SunBurn demo that I've been using so it's a minimal case so I can build on it from there.
Thanks again.
Alic
Posts: 39
Joined: Fri Jul 29, 2011 2:25 pm

Re: I think I'm missing some basic knowledge

Post by Alic »

Wow, that list of math tools and their uses is the best thing I've ever read about physics math and game development. Brief, but so packed with useful information! Have you considered pasting that post into a "physics math for dummies" page in the codeplex documentation section? I'm torn between bookmarking it and getting it tatooed on my forearms.


Alex
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: I think I'm missing some basic knowledge

Post by Norbo »

Glad it helps :)
Have you considered pasting that post into a "physics math for dummies" page in the codeplex documentation section?
I'll stick a link up there back to this thread. One day I might get around to cleaning it up and expanding it into a full article.
Post Reply