Question by
hoangkyanh · Dec 18, 2015 at 04:58 PM ·
c#2d gamegameplay
How to make a bullet arc like bullet of tower in Tower Defense game?
I want to make way for shells arc in tower defense games, but I feel this way problematic. Who can help me ?
protected void BulletArc() {
transform.position = Vector3.MoveTowards(startPosition, target.transform.position, 1f);
Vector3 dir = (target.transform.position - gameObject.transform.position);
float anger = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
Quaternion rotation = new Quaternion();
rotation.eulerAngles = new Vector3(0, 0, anger - 80);
gameObject.transform.rotation = rotation;
}
Comment
Your answer
Follow this Question
Related Questions
Upgrading the OnLevelWasLoded code to sceneloaded in Gamemanager Script for 2D Rougelike game 0 Answers
2D movement along vector 1 Answer
Z position moving in 2D space 1 Answer
New to Unity and Design, need some help :( 1 Answer
I can't seem to rotate my character depending on what side he is running to (2D sidescroller) 0 Answers