I have a VTOL with 4 engines parented to a main hull, which need to rotate on the y-axis relative to the direction the ship is moving. I can’t base rotation on key input as the VTOL is AI controlled. Any ideas how such a thing could be accomplished?
Ok so if its AI controlled its a little bit more complicated than just getting the Input.axis.
My suggestion would be to make an animation clip of the vtol engines in there forward position and in there stationary position. You can then make a blend tree to have a paramter effect which position it will be in. Lets say you use called the variable “Vtol-Engine” for example. (look up on youtube if you havent used these before)
This is not exactly the right code as its off the top of my head but its relatively what you need:
Float yaxis;
Animator AR;
Void Start()
{
AR = getcomponent<Animator>();
}
Void Update()
{
//matching our y-direction to the vtol rotation
AR.SetFloat("Vtol-Engine", yaxis);
}
With the use of the animator and a few more lines of code you should be able to mimic the effect you want
Hope it pushes in the right way! @jordaneden