当前位置: 首页>>代码示例>>C#>>正文


C# Vector4.Set方法代码示例

本文整理汇总了C#中Vector4.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Vector4.Set方法的具体用法?C# Vector4.Set怎么用?C# Vector4.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector4的用法示例。


在下文中一共展示了Vector4.Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RowVector4Field

    public static Vector4 RowVector4Field(Vector4 value, params GUILayoutOption[] options)
    {
        Rect position = EditorGUILayout.GetControlRect(true, 16f, EditorStyles.numberField, options);
        float[] values = new float[]{value.x, value.y, value.z, value.w};

        EditorGUI.BeginChangeCheck();

        EditorGUI.MultiFloatField(
            position,
            new GUIContent[]{new GUIContent(), new GUIContent(), new GUIContent(), new GUIContent()},
            values
        );

        if (EditorGUI.EndChangeCheck()) {
            value.Set(values[0], values[1], values[2], values[3]);
        }

        return value;
    }
开发者ID:ryukbk,项目名称:mobile_game_math_unity,代码行数:19,代码来源:Chapter04Editor.cs

示例2: GetBoardCorner

    /// <summary>
    /// Gets the board corners.
    /// </summary>
    /// <returns>The board corners. lower left and upper right</returns>
    private static Vector4 GetBoardCorner()
    {
        Vector4 returnData = new Vector4 ();

        float cameraSize = Camera.main.orthographicSize;

        if (CurrentScreenOrientation () == ScreenOrientation.Landscape) {
            returnData.Set (BoardAspectRatio () * cameraSize * LEFT_ADJUSTMENT_FACTOR * -1f,
                cameraSize * LOWER_ADJUSTMENT_FACTOR * -1f,
                BoardAspectRatio () * cameraSize * RIGHT_ADJUSTMENT_FACTOR,
                cameraSize * UPPER_ADJUSTMENT_FACTOR);

        } else { //TODO: there is something wrong here!!
            returnData.Set (cameraSize * LEFT_ADJUSTMENT_FACTOR * -1f,
                BoardAspectRatio (true) * cameraSize * LOWER_ADJUSTMENT_FACTOR * -1f,
                cameraSize * RIGHT_ADJUSTMENT_FACTOR,
                BoardAspectRatio (true) * cameraSize * UPPER_ADJUSTMENT_FACTOR);
        }

        return returnData;
    }
开发者ID:sgrozo1,项目名称:Juego_Escalera,代码行数:25,代码来源:Helpers.cs

示例3: MixRPM

    public void MixRPM(float heightFeedforward, float heightCommand, float rollCommand, float pitchCommand, float yawCommand)
    {
        rollCommand =  rollCommand / b0_roll;
        pitchCommand = pitchCommand / b0_pitch;
        yawCommand = yawCommand / b0_yaw;
        heightCommand = heightCommand / b0_z;

        // Apply angle command
        RPM.Set (pitchCommand + rollCommand - yawCommand,
                 pitchCommand - rollCommand + yawCommand,
                 - pitchCommand - rollCommand - yawCommand,
                 - pitchCommand + rollCommand + yawCommand);

        // Clamping of height command
        if (heightFeedforward < 5000)
            heightFeedforward = 5000;
        float heightTotal = heightFeedforward + heightCommand;
        for (int i=0; i<4; i++) {
            if (RPM[i] + heightTotal > maxRPM) {
                heightTotal = maxRPM - RPM[i];
            }
        }

        // Total command
        RPM = RPM + (new Vector4 (heightTotal, heightTotal, heightTotal, heightTotal));

        // Clamp to max
        for (int i=0; i<4; i++) {
            if (RPM[i] < 0) {
                RPM[i] = 0;
            } else if (RPM[i] > maxRPM) {
                RPM[i] = maxRPM;
            }
        }

        RPM.Set (RPM[0]*motorStarted[0], RPM[1]*motorStarted[1], RPM[2]*motorStarted[2], RPM[3]*motorStarted[3]);

        ApplyForces ();
    }
开发者ID:eleurent,项目名称:KestrelFPV,代码行数:39,代码来源:PropellersController.cs


注:本文中的Vector4.Set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。