unity小恐龍模型控制
匯入後有報錯,直接刪除“|| (r is ParticleRenderer)”
using System;
using UnityEngine;
namespace UnityStandardAssets.Cameras
{
public class TargetFieldOfView : AbstractTargetFollower
{
// This script is primarily designed to be used with the "LookAtTarget" script to enable a
// CCTV style camera looking at a target to also adjust its field of view (zoom) to fit the
// target (so that it zooms in as the target becomes further away).
// When used with a follow cam, it will automatically use the same target.
[SerializeField] private float m_FovAdjustTime = 1; // the time taken to adjust the current FOV to the desired target FOV amount.
[SerializeField] private float m_ZoomAmountMultiplier = 2; // a multiplier for the FOV amount. The default of 2 makes the field of view twice as wide as required to fit the target.
[SerializeField] private bool m_IncludeEffectsInSize = false; // changing this only takes effect on startup, or when new target is assigned.
private float m_BoundSize;
private float m_FovAdjustVelocity;
private Camera m_Cam;
private Transform m_LastTarget;
// Use this for initialization
protected override void Start()
{
base.Start();
m_BoundSize = MaxBoundsExtent(m_Target, m_IncludeEffectsInSize);
// get a reference to the actual camera component:
m_Cam = GetComponentInChildren<Camera>();
}
protected override void FollowTarget(float deltaTime)
{
// calculate the correct field of view to fit the bounds size at the current distance
float dist = (m_Target.position - transform.position).magnitude;
float requiredFOV = Mathf.Atan2(m_BoundSize, dist)*Mathf.Rad2Deg*m_ZoomAmountMultiplier;
m_Cam.fieldOfView = Mathf.SmoothDamp(m_Cam.fieldOfView, requiredFOV, ref m_FovAdjustVelocity, m_FovAdjustTime);
}
public override void SetTarget(Transform newTransform)
{
base.SetTarget(newTransform);
m_BoundSize = MaxBoundsExtent(newTransform, m_IncludeEffectsInSize);
}
public static float MaxBoundsExtent(Transform obj, bool includeEffects)
{
// get the maximum bounds extent of object, including all child renderers,
// but excluding particles and trails, for FOV zooming effect.
var renderers = obj.GetComponentsInChildren<Renderer>();
Bounds bounds = new Bounds();
bool initBounds = false;
foreach (Renderer r in renderers)
{
if (!((r is TrailRenderer) || (r is ParticleSystemRenderer)))
{
if (!initBounds)
{
initBounds = true;
bounds = r.bounds;
}
else
{
bounds.Encapsulate(r.bounds);
}
}
}
float max = Mathf.Max(bounds.extents.x, bounds.extents.y, bounds.extents.z);
return max;
}
}
}
下面的把 BuildTargetGroup.WebPlayer,
刪除就可以了
using System;
using System.Collections.Generic;
using UnityEditor;
namespace UnityStandardAssets.CrossPlatformInput.Inspector
{
[InitializeOnLoad]
public class CrossPlatformInitialize
{
// Custom compiler defines:
//
// CROSS_PLATFORM_INPUT : denotes that cross platform input package exists, so that other packages can use their CrossPlatformInput functions.
// EDITOR_MOBILE_INPUT : denotes that mobile input should be used in editor, if a mobile build target is selected. (i.e. using Unity Remote app).
// MOBILE_INPUT : denotes that mobile input should be used right now!
static CrossPlatformInitialize()
{
var defines = GetDefinesList(buildTargetGroups[0]);
if (!defines.Contains("CROSS_PLATFORM_INPUT"))
{
SetEnabled("CROSS_PLATFORM_INPUT", true, false);
SetEnabled("MOBILE_INPUT", true, true);
}
}
[MenuItem("Mobile Input/Enable")]
private static void Enable()
{
SetEnabled("MOBILE_INPUT", true, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
case BuildTarget.BlackBerry:
case BuildTarget.PSM:
case BuildTarget.Tizen:
case BuildTarget.WSAPlayer:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input. You'll need to use the Unity Remote app on a connected device to control your game in the Editor.",
"OK");
break;
default:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input, but you have a non-mobile build target selected in your build settings. The mobile control rigs won't be active or visible on-screen until you switch the build target to a mobile platform.",
"OK");
break;
}
}
[MenuItem("Mobile Input/Enable", true)]
private static bool EnableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return !defines.Contains("MOBILE_INPUT");
}
[MenuItem("Mobile Input/Disable")]
private static void Disable()
{
SetEnabled("MOBILE_INPUT", false, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.WP8Player:
case BuildTarget.BlackBerry:
EditorUtility.DisplayDialog("Mobile Input",
"You have disabled Mobile Input. Mobile control rigs won't be visible, and the Cross Platform Input functions will always return standalone controls.",
"OK");
break;
}
}
[MenuItem("Mobile Input/Disable", true)]
private static bool DisableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return defines.Contains("MOBILE_INPUT");
}
private static BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Standalone,
BuildTargetGroup.WebPlayer,
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WP8,
BuildTargetGroup.BlackBerry
};
private static BuildTargetGroup[] mobileBuildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WP8,
BuildTargetGroup.BlackBerry,
BuildTargetGroup.PSM,
BuildTargetGroup.Tizen,
BuildTargetGroup.WSA
};
private static void SetEnabled(string defineName, bool enable, bool mobile)
{
//Debug.Log("setting "+defineName+" to "+enable);
foreach (var group in mobile ? mobileBuildTargetGroups : buildTargetGroups)
{
var defines = GetDefinesList(group);
if (enable)
{
if (defines.Contains(defineName))
{
return;
}
defines.Add(defineName);
}
else
{
if (!defines.Contains(defineName))
{
return;
}
while (defines.Contains(defineName))
{
defines.Remove(defineName);
}
}
string definesString = string.Join(";", defines.ToArray());
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
}
}
private static List<string> GetDefinesList(BuildTargetGroup group)
{
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
}
}
}
然後就可以使用了
https://www.bilibili.com/video/BV1dA411L7Ho/
https://item.taobao.com/item.htm?spm=a2oq0.12575281.0.0.15d11debwslimz&ft=t&id=630138120475
相關文章
- Chrome 的小恐龍遊戲,被我破解了...Chrome遊戲
- 【前端軼事】Chrome 小恐龍背後的故事前端Chrome
- 使用前端方式挑戰 Chrome 小恐龍遊戲高分前端Chrome遊戲
- 《恐龍獵人2邪惡之種》遊戲攻略 恐龍獵人2遊戲秘籍遊戲
- 強化學習訓練Chrome小恐龍Dino:最高超過4000分強化學習Chrome
- 遊戲主機:拒絕逝去的“恐龍”遊戲
- flutter開發遊戲入門(仿谷歌瀏覽器小恐龍Chrome dino)三Flutter開發遊戲谷歌瀏覽器Chrome
- 強化學習訓練Chrome小恐龍Dino Run:最高超過4000分強化學習Chrome
- Unity控制把執行Unity
- Unity UI優化小結UnityUI優化
- Unity Network 使用小結Unity
- 從《恐龍獵人》到《網路奇兵》,他們如何重製經典遊戲?遊戲
- Unity I18N 小探Unity
- Unity之掛載小問題Unity
- unity 模型無法繞自身中心旋轉Unity模型
- 社群拼團接龍小程式
- unity ui的建立方式小記UnityUI
- YouGov:41%美國民眾認為人類和恐龍曾共存一段時期Go
- ABAC訪問控制模型模型
- Unity3D模型製作規範[轉]Unity3D模型
- Unity3D 的物理渲染和光照模型Unity3D模型
- 【Unity】動態新增Prefab預製體位置控制Unity
- Unity控制檯console列印富文字Unity
- 小度馭龍,逐鹿AI鐵王座AI
- openGauss 訪問控制模型模型
- 資訊流投放月榜分析:《班主任模擬器》、《全民養恐龍》成買量黑馬
- AI 四小龍之間沒有戰爭AI
- 小語言模型指南模型
- Alink漫談(四) : 模型的來龍去脈模型
- prml線性模型小結模型
- 最大熵模型原理小結熵模型
- Unity3D 基礎自學學習筆記(二) Unity3D 基礎控制元件Unity3D筆記控制元件
- 用Unity蓋房子(一):《勇者鬥惡龍:建造者2》遊戲功能的猜想Unity遊戲
- HMM隱馬爾可夫模型來龍去脈(二)HMM隱馬爾可夫模型
- Unity 鏡頭控制 第三人稱自由鏡頭Unity
- 基於PLM訪問控制模型研究模型
- 張小龍:微信十年的產品思考
- 我做了一個成語接龍的小程式