Align to a point
Blitz3D Forums/Blitz3D Programming/Align to a point
| ||
I have a freshly created cube and want to turn it around it's Y axis such that it is pointing at a particular point on the X/Z plane (say 0,-5). AlignToVector makes the cube point at the correct place but achieves this by rotating around the x axis - not what I want. Can anyone tell me how to achieve this? Basically I want to TurnEntity e,0,n,0 until it is correctly aligned - I don't want to use PointEntity because it needs a pivot and is a 'snap' command. TIA |
| ||
Can't you define which axis should be used with AlignToVector ? |
| ||
Not in that way - I want to align the cube's Z axis to the point but that can be achieved by rotating it in X or Y in the example above but AlignToVector seems to choose X. This is what I have... AlignToVector cube,vx,0,vz,3,0.01 (Align the Z axis (3) to vx,0,vz at a 'rate' of 0.01.) |
| ||
This might (might) help: http://www.blitzbasic.com/codearcs/codearcs.php?code=867 At least the math should carry over and it works on the Y axis. L8r, |
| ||
try writing this line just after the AlignToVector() command: RotateEntity cube,0,EntityYaw(cube),0 is it Ok ? |