|
![](/i/fill.gif) |
Ger wrote:
> John VanSickle wrote:
>
>
>>You really don't need to do this arcsin and rotation stuff.
>>
>>The better way to do it is:
>>
>>#local vZ=vnormalize(Position2-Position1);
>>#local vX=vnormalize(vcross(y,vZ));
>>
>>and replace the rotate and translate with this:
>>
>>matrix < vX.x, vX.y, vX.z,
>> 0, 1, 0,
>> vZ.x, vZ.y, vZ.z,
>> Position1.x, Position1.y, Position1.z>
>>
>>It may help you with this to also read
>>
>> http://www.geocities.com/evilsnack/matrix.htm ,
>>
>>which is tutorial I wrote about the matrix transform.
>>
>>Regards,
>>John
>
>
> I had it figured out with a lot of #if's in it, but I tried your solution
> anyway because it looks so much more elegant.
> But now a wall is rotated y * 90 from where it is supposed to be.
If the wall is built along the x axis prior to is positioning, then use
this code to calculate vX and vZ:
#local vX=vnormalize(Position2-Position1);
#local vZ=vnormalize(vcross(vX,y));
The matrix remains the same.
Regards,
John
Post a reply to this message
|
![](/i/fill.gif) |