- Home /
2D Homing Missile with inertia
hey guys,
I would like to make a homing missile which works in a 2D game, meaning that all the rotation happens only on the z axis.
Sadly functions like LookAt only work in a 3D environment, since they utilize all 3 axis to direct the object.
I also would like the missile to have inertia, meaning, that if the targeted object moves, the missile doesnt make sharp corners but transitions naturaly.
I would be really thankful if you could help me out here.
Thanks guys.
you do 2D games exactly like 3D games and you can use all the same physics and maths. the only difference is, set the camera to Orthographic.
in your case things like gravity, AddForce constantForce and so on will help you - exactly like in a 3D game. no difference
Answer by OtreX · Apr 22, 2016 at 05:09 AM
I'm facing the same problem. I got it fixed-ish by creating an empty gameObject and attaching my 3d missile script, then assigning the X and the Y value of the sprite to be the same of that empty gameObject. It's not an elegant solution and it might be too much to handle for a mobile devices game and that is exactly my case. Also, every now and then, the empty gameObject will begin to travel on the Z axis and even when the sprite's tranform.position.z is locked, it looks weird and breaks the game.
Your answer
![](https://koobas.hobune.stream/wayback/20220613081235im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
What does the "compute mesh inertia tensor failed" error mean? 6 Answers
Why am I being asked to change the mesh geometry or supply a tensor manually? 1 Answer
How to create homing missile that follows path using Unity and iTween 1 Answer
Homing projectile 0 Answers
Spinning an object using touch input 7 Answers