SailBoatGame-SailSystemScript

Hi, i’m italian and my english isn’t very good but i hope you can help me:
I’m making a Sail Game and i want that when my ship is between 30 an 90 degrees my beautiful mainsail is shown; i try to use this script:

function Update () {

if (((transform.eulerAngles == Vector3(0,30,0)) && (transform.eulerAngles == Vector3 (0,90,0)))
{
	RBSx.renderer.active = true;
}

PLEASE HELP ME!!!

Well, your English is better than your maths. Your code will set the renderer active if and only if the eulerAngles are exactly (0,30,0) AND exactly (0,90,0) at the same time, which is not a common occurrence.

Also, I can see sailboats out on the bay every day here and I have never noticed their main sails blinking out of existence every time they turn downwind, so you should probably rethink your whole approach anyway.

What you want is if ((a > b) && (a < c)).

You need to figure out your wind direction- which may not be the world Z axis, and calculate angles relative to that.
Here’s a minimal set of things you’re going to have to take into account to control the boat’s behavior in a realistic way-

var rudder : float; // steering, -1 to 1, causes the boat to rotate on Y axis
var boom : float; // local y rotation of the boom relative to the boat
var jib : float; // how much the rope to the front sail is let out

var windSpeed : float;
var boatSpeed : float;
var windDir : Vector2; 
var heading : Vector2;
var attack : float; // angle between windDir and heading
var tilt : float; // boat's z axis rotation- depends on boom, jib, windSpeed, and attack

function Tack(){} //flip sail direction when boat crosses wind direction upwind

function Jibe(){} //flip sail direction when boat crosses wind direction downwind