# Boat&#39;s rotation in relation to the rudder

Hello,
I’m trying to create a sailing ship. A part of this is trying to set up the rotation of the ship in relation to the rudder, so when the rudder is turned left the ship turns right and when the player turns it right the boat should straighten up and then go left.

``````	if(Input.GetKey("left")){
if(int_Rotation > int_Min_Rotation){
int_Rotation --;// decrease 1 rotation
go_Rudder.transform.Rotate(0,fl_Rotation_Speed,0); // rotate boat right
}
}

if(Input.GetKey("right")){
if(int_Rotation < int_Max_Rotation){
int_Rotation ++;// decrease 1 rotation
go_Rudder.transform.Rotate(0,-fl_Rotation_Speed,0); // rotate boat left
}
}
``````

I have tried using eulerangles but so far I have had no luck. Most of my attempts have ended with a type of rotation I didn’t want.

Regards,
Ian

float m_rotation = 0 ;
float m_rotationIncrement = 1;
float m_rotationLimit = 45; // 45 degrees
float m_drag = 0.9997f;

``````void FixedUpdate()
{
if(Input.GetKey("left"))
{
m_rotation += -m_rotationIncrement  * time.detlaTime;
}

if(Input.GetKey("right"))
{
m_rotation += -m_rotationIncrement  * time.detlaTime;
}

m_rotation  = Mathf.Clamp(m_rotation , -m_rotationLimit , m_rotationLimit );

this.transform.rotate(0,m_rotation  ,0);
m_rotation  *=m_drag ;
}
``````