Align to Vector help

Blitz3D Forums/Blitz3D Programming/Align to Vector help

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Well, think about a 3D space with an origin (0,0,0) and some point away from the origin (x,y,z). The line from the origin to that x,y,z point is a vector. So the command "AlignToVector entity,x,y,z,1" will align the entity's X axis along that vector. The vector 1,0,0 and the vector 1000,0,0 will give you the same result; the length of the vector doesn't matter, just the direction it's pointing.

As for aligning an entity to a surface ... I suppose you could find the normal of the surface you're touching, and then align your model's Y axis to that normal. (A normal is a 1-unit-long vector which points straight out 90 degrees from the surface of a triangle.) I haven't looked at driver.bb recently, though, so he may have a better idea than I do.