Aim a 2D Sprite, make a 3D Model rotate ?
Blitz3D Forums/Blitz3D Beginners Area/Aim a 2D Sprite, make a 3D Model rotate ?
| ||
Hi Everybody, So I have a Turret on my Tank(3d) and would like to aim it via a 2D Sprite...or a 3D Sprite and have the Turret move up/down reflecting the mouse movement. Any ideas? I searched but cannot find anything on this, so if it's in the code archs someone got a link ? thanx :) |
| ||
Can't you just adjust the pitch of the turret based on the y-coordinate of the mouse cursor? Eg Graphics 800,600,0,2 MaxPitch# = 45.0 ; limit the angle to a maximum of +- 45 degrees as an example Repeat Pitch# = MaxPitch# * Float(MouseY() - (GraphicsHeight() / 2)) / (GraphicsHeight() / 2) Cls Text 0,0,Pitch Flip Until KeyDown(1) |
| ||
Take a look and see how Tiny Tanks does it. |