Problem with AlignToVector

Blitz3D Forums/Blitz3D Programming/Problem with AlignToVector

martonic(Posted 2004) [#1]
Hi! I have a terrain-based level on which I "recycle" enemies (3DS models) when they die. However, once in a while, they come back upside down - feet on the terrain, but head below the ground. This is a sporadic problem; it seems to occur about once every 20 "recycles". Here is the code:

Animate E\Entity,0				
HideEntity E\Entity
PositionEntity E\Entity,x,y,z
ShowEntity E\Entity
ResetEntity E\Entity
AlignToVector E\Entity,0,1,0,2
Animate E\Entity,3,1.0,static,0


The "AlignToVector" command is intended to align the y-axis of the model with the "straight-up" direction, that is, with the vector (0,1,0). However, about one time in twenty, the result is alignment with the "straight-down" direction instead.

Can anyone shed any light on this, or has anyone else noticed the same problem?

Thanks!


Tom(Posted 2004) [#2]
Try reseting the rotation to 0,0,0 before aligning.


martonic(Posted 2004) [#3]
Thanks!