资源简介
Unity3d游戏框架中的消息机制,解耦合,代码有文档参阅
代码片段和文件信息
// A 3ds max styled orbit/zoom/pan type camera. cobbled together from various sources by dbuchhofer.
// Content is available under Creative Commons Attribution Share Alike.
// Filename: maxCamera.cs
//
// original: http://www.unifycommunity.com/wiki/index.php?title=MouseOrbitZoom
//
// --01-18-2010 - create temporary target if none supplied at start
//////// Unluck Software Edit - http://www.chemicalbliss.com
// --02-28-2013 - changes
// - Added smooth camera stop
// - Added smooth idle rotation
// - Removed middle click behaviour
// - Renamed file to “SmoothCameraOrbit.cs“
using UnityEngine;
using System.Collections;
[AddComponentMenu(“Camera-Control/Smooth Mouse Orbit - Unluck Software“)]
public class SmoothCameraOrbit : MonoBehaviour
{
public Transform target;
public Vector3 targetOffset;
public float distance = 5.0f;
public float maxDistance = 20;
public float minDistance = .6f;
public float xSpeed = 200.0f;
public float ySpeed = 200.0f;
public int yMinLimit = -80;
public int yMaxLimit = 80;
public int zoomRate = 40;
public float panSpeed = 0.3f;
public float zoomDampening = 5.0f;
public float autoRotate = 1;
private float xDeg = 0.0f;
private float yDeg = 0.0f;
private float currentDistance;
private float desiredDistance;
private Quaternion currentRotation;
private Quaternion desiredRotation;
private Quaternion rotation;
private Vector3 position;
private float idleTimer = 0.0f;
private float idleSmooth = 0.0f;
void Start() { Init(); }
void OnEnable() { Init(); }
public void Init()
{
//If there is no target create a temporary target at ‘distance‘ from the cameras current viewpoint
if (!target)
{
Gameobject go = new Gameobject(“Cam Target“);
go.transform.position = transform.position + (transform.forward * distance);
target = go.transform;
}
//distance = Vector3.Distance(transform.position target.position);
currentDistance = distance;
desiredDistance = distance;
//be sure to grab the current rotations as starting points.
position = transform.position;
rotation = transform.rotation;
currentRotation = transform.rotation;
desiredRotation = transform.rotation;
xDeg = Vector3.Angle(Vector3.right transform.right );
yDeg = Vector3.Angle(Vector3.up transform.up );
position = target.position - (rotation * Vector3.forward * currentDistance + targetOffset);
}
/*
* Camera logic on LateUpdate to only update after all character movement logic has been handled.
*/
void LateUpdate()
{
// If Control and Alt and Middle button? ZOOM!
if (Input.GetMouseButton(2) && Input.GetKey(KeyCode.LeftAlt) && Input.GetKey(KeyCode.LeftControl))
{
desiredDistance -= Input.GetAxis(“Mouse Y“) * 0.02f * zoomRate*0.125f * Mathf.Abs
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-11-07 10:31 消息机制\
目录 0 2018-11-08 19:17 消息机制\EventNode\
文件 552547 2017-04-12 13:49 消息机制\EventNode.zip
目录 0 2018-11-07 10:29 消息机制\EventNode\.vs\
目录 0 2018-11-07 10:29 消息机制\EventNode\.vs\EventNode\
目录 0 2018-11-07 10:29 消息机制\EventNode\.vs\EventNode\v14\
文件 209408 2018-11-08 19:17 消息机制\EventNode\.vs\EventNode\v14\.suo
文件 4402 2016-11-10 09:37 消息机制\EventNode\Assembly-CSharp.csproj
目录 0 2018-11-08 17:17 消息机制\EventNode\Assets\
目录 0 2018-11-08 17:17 消息机制\EventNode\Assets\Liquid Particle Systems\
文件 191 2018-11-08 17:17 消息机制\EventNode\Assets\Liquid Particle Systems.me
目录 0 2018-11-08 17:17 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\
文件 191 2018-11-08 17:17 消息机制\EventNode\Assets\Liquid Particle Systems\Materials.me
文件 4228 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain Heavy PRT MAT Alpha.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain Heavy PRT MAT Alpha.mat.me
文件 4224 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain PRT MAT Alpha.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain PRT MAT Alpha.mat.me
文件 4232 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain Splash PRT MAT Aplha.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Rain Splash PRT MAT Aplha.mat.me
文件 4284 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Skybox Gradient MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\Skybox Gradient MAT.mat.me
文件 4232 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Colored Blood MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Colored Blood MAT.mat.me
文件 4232 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Diffuse Gray MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Diffuse Gray MAT.mat.me
文件 4228 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 1 MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 1 MAT.mat.me
文件 4228 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 2 MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 2 MAT.mat.me
文件 4228 2014-09-26 09:09 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 3 MAT.mat
文件 161 2018-11-08 17:16 消息机制\EventNode\Assets\Liquid Particle Systems\Materials\uLiquid - Particle 3 MAT.mat.me
............此处省略834个文件信息
- 上一篇:BWT 转换 源代码
- 下一篇:Unity3DPatch_5.6.x.zip
相关资源
- Unity3DPatch_5.6.x.zip
- Pocket+RPG+Weapon+Trails+武器拖尾效果(
- Unity3D挥剑(剑痕特效)
- Unity3D 虚拟手DEMO
- unity3d武器拖尾特效
- 在Unity中整合LUA的DEMO
- U3D之WebCamTexture实现前后相机的拍照功
- NGUI版的虚拟摇杆
- Unity3d调色板
- Graph Maker1.3
- Unity3D期末
- SilverLining Skies 3D Clouds v1.9.unitypackage
- Unity3D 角色控制器CharacterController
- NavMesh 2D.unitypackage
- unity3d串口数据显示.docx
- Dynamic Bone V1.2.2
- Unity3d常用中文字体
- 鱼游动逻辑算法
- Unity 3D小游戏
- U3D与OBJ互转
- Unity3d传送门模型
- Unity3d UGUI
- unity3d 美食游戏模板
- Unity刮刮乐效果、绘制透明工程
- unity3d答题系统
- U3D从入门到精通PDF和资源文件
- glu3d 3dmax流体插件
- unity3d 一个简单的足球demo
- SimplePath 1.11(最新完整版)
- leapmotion拼图
评论
共有 条评论