Align object to a face

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/05/2006 at 01:23, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   8+ 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
To simulate that an object is moving on a surface, I need to align an object to a face. I know collision point with the surface, and I get the normal of the found face, now I need to rotate the object according with the normal! This make me crazy, I'm new on vector math, and I can't find a way to do this!
Can someone help me with an exhaustive example ?
Thank's

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/05/2006 at 03:36, xxxxxxxx wrote:

The normal alone does not specify the rotation fully. You also need to specify a direction within the surface for the bank. Then the normal will be the Z azis and the chosen direction will be the X axis. The Y axis is Z % X, where % is the cross product.
You can do these things directly in the object matrix. Just make sure that the vectors are normalized.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 31/05/2006 at 06:29, xxxxxxxx wrote:

Thank's Mikael, I'll test it, I hope to have understood!