示例#1
0
    public void ExertForce()
    {
        currentThrust = thrustPercent * maxThrust * 1000f;
        Vector3 thrustVector = thrustUnitVector.normalized * currentThrust;          //N

        physicsEngine.AddForce(thrustVector);
    }
示例#2
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (fuelMass > FuelThisUpdate())
     {
         fuelMass           -= FuelThisUpdate();
         physicsEngine.mass -= FuelThisUpdate();
         ExertForce();
         physicsEngine.AddForce(thrustUnitVector);
     }
     else
     {
         Debug.LogWarning("Out of rocket fuel");
     }
 }
示例#3
0
    private void ExertForce()
    {
        _currentThrust = ThrustPercent * MaxThrust * 1000f;
        var thrustVector = ThrustUnitVector.normalized * _currentThrust;

        _physicsEngine.AddForce(thrustVector);
    }
示例#4
0
    void ExertForce()
    {
        currentThrust = maxThrust * thrustPercent * 1000f;                       //牛頓  [kg * m/s^2]
        Vector3 thrustVector = currentThrust * thrustDirectionVector.normalized; //牛頓  [kg * m/s^2]

        physicsEngine.AddForce(thrustVector);
    }
 /// <summary>
 /// Amount of exerted force based on thrust % (percent).
 /// </summary>
 void ExertForce()
 {
     currentThrust = thrustPercent * maxThrust * 1000f;           // N (kN*1000=N)
     //normalized - ensures thrust unit vector only shows direction
     thrustVector = thrustUnitVector.normalized * currentThrust;  // N
     physicsEngine.AddForce(thrustVector);
 }
示例#6
0
    void ExertForce()
    {
        currTrust = thrustPercent * maxThrust * 1000;
        Vector3 thrustVector = ThrustUnitVector.normalized * currTrust;

        phsx.AddForce(thrustVector);
    }
示例#7
0
    private void ExtertForce()
    {
        currentThrust = thrustPercent * maxThrust;
        //Vector3 thrustVector = Vector3.Normalize(thrustUnitVector) * currentThrust;
        Vector3 thrustVector = Vector3.Normalize(this.transform.forward) * currentThrust;

        physicsEngine.AddForce(thrustVector);
    }
示例#8
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 velocityVector = -physicsEngine.velocity;
        float   speed          = velocityVector.magnitude;
        float   dragSize       = CalculateDrag(speed);
        Vector3 dragDirection  = dragSize * velocityVector;

        physicsEngine.AddForce(dragDirection);
    }
示例#9
0
    private void FixedUpdate()
    {
        var   velocityVector = _physicsEngine.VelocityVector;
        float speed          = velocityVector.magnitude;
        float dragSize       = CalculateDrag(speed);
        var   dragVector     = dragSize * -velocityVector.normalized;

        _physicsEngine.AddForce(dragVector);
    }
示例#10
0
    void FixedUpdate()
    {
        Vector3 velocityVector = physics.velocityVector;
        float   speed          = velocityVector.magnitude;
        float   dragScale      = CalculateDrag(speed);
        Vector3 dragVector     = dragScale * -velocityVector.normalized;

        physics.AddForce(dragVector);
    }
示例#11
0
    private void FixedUpdate()
    {
        float speed    = physicsEngine.velocityVector.magnitude;                    //vector length
        float dragSize = CalculateDrag(speed);

        Vector3 dragVector = dragSize * -physicsEngine.velocityVector.normalized;   //speed directed

        physicsEngine.AddForce(dragVector);
    }
示例#12
0
    void FixedUpdate()
    {
        Vector3 velocityVector = physicsEngine.velocityVector;
        float   speed          = velocityVector.magnitude;

        float   dragSize   = CalculateDrag(speed);      //drag magnitude
        Vector3 dragVector = dragSize * -velocityVector.normalized;

        physicsEngine.AddForce(dragVector);
    }
    void ExertForce()
    {
        currentThrust = thurstPercent * maxThurst * 1000f;                  //kN
        Vector3 thrustVector = thurstUnitVector.normalized * currentThrust; // N

        if (thrustVector != Vector3.zero)
        {
            physE.AddForce(thrustVector);
        }
    }
示例#14
0
    void FixedUpdate()
    {
        Vector3 velocityVector = physicsEngine.velocityVector;
        float   speed          = velocityVector.magnitude; //Turns vector into scalar
        float   dragMagnitude  = dragConstant * Mathf.Pow(speed, velocityExponent);
        //The minus is needed because the drag's direction is opposite of the object's velocity
        //Normalized is needed because we only need the orientation of the velocity vector
        Vector3 dragVector = dragMagnitude * (-velocityVector.normalized);

        physicsEngine.AddForce(dragVector);
    }
示例#15
0
 // Update is called once per frame
 void Update()
 {
     if (physicsEngine)
     {
         physicsEngine.AddForce(Vector3.Cross(rigidBody.angularVelocity, rigidBody.velocity) * magnusConstant);
     }
     else if (rigidBody)
     {
         rigidBody.AddForce(Vector3.Cross(rigidBody.angularVelocity, rigidBody.velocity) * magnusConstant);
     }
 }
示例#16
0
    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 finalForce = force;

        if (countMass)
        {
            finalForce *= physics.mass;
        }
        if (!stopForce)
        {
            physics.AddForce(force);
        }
    }
示例#17
0
 private void FixedUpdate()
 {
     _phisicsEngine.AddForce(thrustUnitVector);
 }
示例#18
0
 private void FixedUpdate()
 {
     _physicsEngine.AddForce(forceVector);
 }
示例#19
0
 // Update is called once per frame
 void FixedUpdate()
 {
     physicsEngine.AddForce(thrustUnitVector);
 }
示例#20
0
 private void FixedUpdate()
 {
     phsx.AddForce(forceVector);
 }