ict.xunfei/Assets/Scripts/UAV/UAV.cs

61 lines
1.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UAV : MonoBehaviour
{
/// <summary>
/// 无人机旋翼
/// </summary>
public Transform[] Uav_RotorWings;
/* 顺序为俯视左上左下右下右上,如下所示
* 14
* 23
*/
public float angle1 = 1;
public float angle2 = 1;
public float angle3 = 1;
public float angle4 = 1;
private void Update()
{
Uav_RotorWings[0].Rotate(Vector3.up, angle1);
Uav_RotorWings[1].Rotate(Vector3.down, angle2);
Uav_RotorWings[2].Rotate(Vector3.up, angle3);
Uav_RotorWings[3].Rotate(Vector3.down, angle4);
UpdatePosition();
}
public void RotorWingRotating(params Transform[] wings)
{
Array.ForEach(wings, wing =>
{
});
}
/*
* 飞行规则:
* 假设无人机起飞所需升力为4则需要每根旋翼提供至少1
* 1,2对应Z+
* 3,4对应Z-
*
* 1,4对应X+
* 2,3对应X-
*
* 1,3对应Y+
* 2,4对应Y-
*/
/// <summary>
/// 更新位置
/// </summary>
public void UpdatePosition()
{
}
}