Sorry if this is an exceedingly simple question; somehow haven't been able to find an answer.
Within TankChassis I have "TankTurret", with the script "TurretControl" that rotates the turret between -110 and +110 degrees (eulerAngles.y) depending on the x position of the mouse.
What I want to do is add directionAngle from TankChassis to the angle of the turret so that the turret rotates in relation to the tank chassis.
What's the best way to do this? Tl;dnr - how do I get a child's script to read a variable from a script in its parent?
(I'm learning Unity by brute force; hope I'm not bothering anyone with simple questions!)
Thank you so much!
(A picture of my cute, derpy tank for your trouble: http://i46.tinypic.com/fnten7.png )
Edit: moved from comments, really more of an answer i guess
must be taking direct input off of the mouse position, in which case.. if you really want to, you could add a var and pass the difference of the tanks rotation to it..
oh,and as for how to read the var,you could just say:
once you have that, you can access other scripts you're after too, with
one good way would be to just use the distance of mouse movement to apply the rotation:
not tested but should work, at least to give an idea
and glad to help!