Shiftt gun cursor with 1 degree in 2d Game
Hi Friends, I am developing 2d game.
I have gun,trigger and Cross Hair working correctly.
Trigger is child object of gun from where I am shooting my bullet on fire button press.
Cross hair is not child object of gun and I am placing cross hair based on user touch.
I am able to shoot bullet where user touch and my cross hair always at same position of user touch.
To allow user to shoot with more accuracy I have designed two button.
Button Simply shift gun upwards or downwards by 1 degree.
Now problem starts.
I am not able to position cross hair correctly after 1 degree shift of gun.
I have tried alternative like
temp.x = crossHair.position.x * Mathf.Cos (angle) - crossHair.position.y * Mathf.Sin (angle);
temp.y = crossHair.position.x * Mathf.Sin (angle) + crossHair.position.y * Mathf.Cos (angle);
temp.z = 0;
crossHair.position = temp; but after doing it cross hair always following some fixed circular path.
Not working so I am Helpless and clueless :(
Please note that gun ,bullet shooting etc working fine after moving upwards or downwards the only question here is to correctly position the cross hair after some degree movement.