本文整理汇总了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;
}
示例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;
}
示例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 ();
}