I want to add relative force component in game object but it shows error

GetComponent.AddRelativeForce( Vector3.up * max_Rotor_Force * rotor_Velocity );

I get this error for above code:-

Assets/heliControl.js(28,14): BCE0019: ‘AddRelativeForce’ is not a member of ‘function(System.Type): UnityEngine.Component’.

Yes, you can’t add a relative force to a Component unless that Component happens to be a Rigidbody (or Rigidbody2D).

So, assuming this script is attached to your object, and your object has a Rigidbody (I’m not super confident with Unity JavaScript so I’ve tried to translate this from C#):-

var rb: Rigidbody;
rb = GetComponent.<Rigidbody>();
rb.AddRelativeForce(Vector3.up * max_Rotor_Force * rotor_Velocity);

That should get it working.

//you must specify that getcomponent is a rigidbody.
GetComponent().AddRelativeForce(Vector3.up,max_Rotor_Force);