|
Hi, Im writing a simple tank game, It has a tank with a turret and a cannon attached and a hilly terrain. The problem is that when the tank is at an angle the script doesnt rotate the turret and the cannon correctly. The turret house should only rotate on Z and the cannon attached on X.
I think the problem is that my script doesnt take into account the new angle the tanks is in. The following script controls the turret.
(comments are locked)
|
|
just another suggestion, I would make sure that the script is operating in local space not world space. When in local space, the script should ignore the world space rotation of your tank.
(comments are locked)
|
|
Have a look at this question, which goes into detail on locking rotation and that kind of thing. It also has a good follow script, just make sure your player is tagged "Player".
(comments are locked)
|
|
You could also separate the turret as a game object and the tank as another game object and reprogram 2 scripts one for tank and one for turret. And possibly use input functions to control the tank and turret as u see fit. The Tank and the turret has its own script. The tank is controled my the keypad, and the turret locks on to a target via mouse. Maybe I didnt explain my problem correctly. The turret and cannon rotate, on a level surface, correctly. It aims the cannon at its target. But when the tank goes up a hill or is leaning sideways, the aim is of. The turret doesnt rotate correctly. It appears to not rotate enough...
Apr 29 '10 at 09:26 AM
Tryggvi
(comments are locked)
|
|
I think Ive realized the problem. It has to do with the change in x axis when importing from blender. http://answers.unity3d.com/questions/6635/ Tryggvi 17 mins ago
(comments are locked)
|

I think Ive realized the problem. It has to do with the change in x axis when importing from blender. http://answers.unity3d.com/questions/6635/asset-import-from-3dsmax-rotation-issue