• Content count

  • Joined

  • Last visited

Community Reputation

104 Neutral

About rahilbaber

  • Rank
  1. 3D rotation question

    For anyone still following this thread, the problem was HobbyDude was applying the matrix ma to the world objects but should have been applying the inverse of ma (or equivalently the transpose of ma).
  2. 3D rotation question

    When you do the cross-product calculations maksure you get the order of your vectors correct. For example the second column vector of ma should be the 3rd vector cross the 1st vector of m, you've done it the other way around (1st cross the 3rd). As a result you're matrix will represent a reflection and rotation causing your ship to flip every frame. As for the viewport swaying and swirling make sure you have the rotation matrices applied in the right order rotating about the x-axis then the y-axis is not the same as rotating first about the y-axis then the x-axis. If you still can't get it to work e-mail me the source of your project and I'll see what I can do.
  3. 3D rotation question

    [quote name='HobbyDude' timestamp='1305592265' post='4811714'] That's weird, I thought I was performing the cross-product on the new vector... ma®© is supposed to be the original axis vector, and m®© is supposed to be the updated vector. [/quote] I wasn't referring to m or ma but the process by which you reorthogonalize Suppose the matrix you want to reorthogonalize is composed of column vectors u,v, and w (in that order) Step 1 set V as w cross u [ Note that V is orthogonal to u ] Renormalize V by dividing by | V | Step 2 set W as u cross V (It is important that we use the new vector V and not the old vector v, which is the mistake you made) [ Note that W is orthogonal to both u and V ] Renormalize W by dividing by | W | Step 3 set U as u / |u| (i.e. renormalize u) The new reorthogonalized matrix has column vectors U,V, and W (in that order)
  4. 3D rotation question

    ma is a matrix that represents the orientation of the object it's columns are vectors representing the direction of the 3 axis of the object if the column vectors are normalized (which I'm assuming they are) then ma can also be viewed as a rotation matrix. First you created rotation matrices y and x based on the orientation of your ship. Then you multiplied x and y to create an overall rotation matrix m. So far so good. m represents the rotational change you want to apply, but importantly it hasn't been applied to the orientation matrix. In order for this rotation to take effect you need to multiply it with ma to create a new ma which represents the new orientation of your ship. Once you have this new ma you can reorthagonalize it to avoid it drifting. Since ma can be thought of as a rotation matrix you can apply it to vectors xTemp, yTemp, zTemp to update the simulation. The reason it's not updating is that you need to apply m to ma and copy the resulting matrix back into ma.
  5. Bezier Curves

    I don't really understand your first question As for your second question, in general your control points lie in a 2d plane it is unlikely that just by chance they'll lie on a 1d line like the curve. One way to force an inner control point to lie on the curve is to place it at an end control point. Another way is to draw a curve such that the line formed from the end control point and the inner control point cuts the curve (finding such a curve is easy). Then move the inner point linearly towards the end control point and by the intermediate value theorem you should be able to find a point where the inner point lies on the curve.
  6. y=log(x+1) shaped curve where x=infinity -> y=1

    log x tends to infinity as x tends to infinity, so how about 1 - 1/(x+1) ?
  7. 3D rotation question

    Oops my mistake I should've checked the code a lot more more carefully. HobbyDude did normalize all three vectors, but as alvaro pointed out the re-orthogonalization still isn't quite right. When HobbyDude takes the cross-product of right and up vectors I assumed he was using the new up vector but instead he uses the old up vector.
  8. 3D rotation question

    I haven't looked at your code in much detail, so my comments may be wrong. - You applied matrix m at the end to get xTemp,yTemp,zTemp. Did you mean to apply matrix ma instead? - The new matrix ma probably needs to be multiplied by the old ma to update the orientation. (Currently ma calculates the change in orientation it does not represent the "total" orientation) - You only normalized one column during re-orthoganalization you need to renormalize all of them.
  9. Derivation of rotation matrices

    I described an angle-axis rotation matrix on page 34 of http://www.euclideanspace.com/physics/dynamics/collision/practical/RahilBaberCorrectionToBrianMirtich.pdf you'll need to look at the bottom of page 7 to make sense of some of the notation. I wasn't really trying to make it easy to understand so apologies if you find it a bit confusing but I thought it might help a little.
  10. Adding friction to collision impulse

    I'm not sure your maths is right (but I haven't checked it very thoroughly) For example you don't use the intertia tensor in the denominator calculation (which isn't such a big issue as it should be the identity matrix times a scalar) Also you don't show how you calculated the normal impulse and you don't apply it to the body before/after the tangential impulse. The general concepts are right though: Calculate the normal impulse (and apply it, this won't affect the tangential velocity as the two are independent for a sphere) Apply the coefficient of friction times the normal impulse tangentially (if it would cause the tangential velocity to reverse apply an impulse which causes the velocity to go to zero instead) It is perfectly reasonable for an impulse to be applied at the first collision (although it is not rotating there is still a relative tangential velocity) and it is also acceptable that the relative tangential velocity could be zero by the second collision. If you want to deal with non-spherical shapes things become more complicated, check out for one way to deal with friction: [url="http://www.euclideanspace.com/physics/dynamics/collision/practical/RahilBaberCorrectionToBrianMirtich.pdf"]http://www.euclidean...rianMirtich.pdf[/url] I wrote some source code here: [url="http://www.euclideanspace.com/physics/dynamics/collision/practical/Simple2DCollisionsWithFriction.c"]http://www.euclidean...sWithFriction.c[/url] It can be easily modified to simulate a ball bouncing for comparison to your simulation.
  11. Friction impulse. Need formula.

    You may find my post useful: http://www.gamedev.net/topic/596977-collisions-involving-friction-explained-partly/ I wrote up a description of Brian Mirtich's algorithm. For 2D (non-resting) collisions there isn't a single formula but there's a quick algorithm. For 3D collisions the algorithm involves numeric integration which may be too slow for your application.
  12. Intersection of looping path and area inside

    The winding number sounds like a good idea, except it doesn't take into account spirals. A slightly modified approach might be to first detect an intersection in your path then use the line segments that form the loop to create a set of winding numbers. You could also decompose the loop into convex polygons and check if each object lay inside them but the winding number solution sounds a lot nicer.
  13. Collisions involving friction explained (partly)

    Thanks Erwin. I doubt you'll learn much from my document if you're familar with Mirtich's thesis. The key differences are always integrate with respect to p_z (not u_z) and be aware that two compression/decompression phases can occur. The derivation becomes simpler when you don't have to worry about integrating with u_z, so I thought it would be worth rewriting also I collected the formulas in one place to make an explicit algorithm for people who aren't concerned with the technical details. The LCP approach to sliding contacts seems really interesting as does the SI / PGS method of solving them. I hope to really understand the Bullet implementation in the very near future. Are you planning on creating any documents to explain how Bullet works for simpletons like me who are less knowledgeable of the whole LCP and PGS approach. I am aware there are slides and source code available for download but a not overly technical document fully explaining the key ideas would be great. Rahil
  14. Collisions involving friction explained (partly)

    Sounds like a similar system to Box2D. Thanks for the info.