I have a ball rolling on a giant board, except the board is made up of many small boxes. When the ball rolls over a certain box, I have it setup so the ball has a force added to it straight up (supposed to be a 'spring' tile). Thing is, if the board is rotated, I want the ball shot in the direction tangent to the board… how do I do so?
Well I'm sure there is a proper mathematical approach, but I can't give you that one. What I can suggest might work though…
When you attach your spring tile to the scene, you can also attach some other node to your tile and set its local translation one unit up. Then when you rotate your spring tile, you can get the world translation of both your tile and that other node, subtract tile translation from node translation and voila! Then you have a direction vector which is tangent to your tile surface.
I myself have to admit, this is a horrible solution; but its the simplest way I though of as a concept test. Honestly I think you should be able to use the rotation matrix to get your vector. XD
So you want to apply a force if a ball hits some special other geom, right? You can already detect that? How do you do it? If you do it physically (collision handler) you already have the contact normal, and as we talking about a sphere, that normal should already point into the desired direction - multiply it with some custom value and add it as force…
note: depending on the cpu you can spend (or the number of such "spring boxes" you need) you could model those with an actual geom that is pushing the ball away - should be very easy with a joint (single translational axis)…
Or you can do it irrisor's way. LOL :-o
Why not just get the cross product of the two vectors that make up the contact plane, and then simply apply the desired force in the resulting vector?
No joints required at all.
(Edit: after re-reading irrisor's post I realized this is exactly what he is saying, just getting the normal in a different way)