资源简介
unity3d 一个简单的足球demounity3d 一个简单的足球demounity3d 一个简单的足球demo
代码片段和文件信息
using UnityEngine;
using System.Collections;
/// MouseLook rotates the transform based on the mouse delta.
/// Minimum and Maximum values can be used to constrain the possible rotation
/// To make an FPS style character:
/// - Create a capsule.
/// - Add a rigid body to the capsule
/// - Add the MouseLook script to the capsule.
/// -> Set the mouse look to use LookX. (You want to only turn character but not tilt it)
/// - Add FPSWalker script to the capsule
/// - Create a camera. Make the camera a child of the capsule. Reset it‘s transform.
/// - Add a MouseLook script to the camera.
/// -> Set the mouse look to use LookY. (You want the camera to tilt up and down like a head. The character already turns.)
[AddComponentMenu(“Camera-Control/Mouse Look“)]
public class MouseLook : MonoBehaviour {
public enum RotationAxes { MouseXAndY = 0 MouseX = 1 MouseY = 2 }
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityX = 15F;
public float sensitivityY = 15F;
public float minimumX = -360F;
public float maximumX = 360F;
public float minimumY = -60F;
public float maximumY = 60F;
float rotationX = 0F;
float rotationY = 0F;
Quaternion originalRotation;
void Update ()
{
if (axes == RotationAxes.MouseXAndY)
{
// Read the mouse input axis
rotationX += Input.GetAxis(“Mouse X“) * sensitivityX;
rotationY += Input.GetAxis(“Mouse Y“) * sensitivityY;
rotationX = ClampAngle (rotationX minimumX maximumX);
rotationY = ClampAngle (rotationY minimumY maximumY);
Quaternion xQuaternion = Quaternion.AngleAxis (rotationX Vector3.up);
Quaternion yQuaternion = Quaternion.AngleAxis (rotationY Vector3.left);
transform.localRotation = originalRotation * xQuaternion * yQuaternion;
}
else if (axes == RotationAxes.MouseX)
{
rotationX += Input.GetAxis(“Mouse X“) * sensitivityX;
rotationX = ClampAngle (rotationX minimumX maximumX);
Quaternion xQuaternion = Quaternion.AngleAxis (rotationX Vector3.up);
transform.localRotation = originalRotation * xQuaternion;
}
else
{
rotationY += Input.GetAxis(“Mouse Y“) * sensitivityY;
rotationY = ClampAngle (rotationY minimumY maximumY);
Quaternion yQuaternion = Quaternion.AngleAxis (rotationY Vector3.left);
transform.localRotation = originalRotation * yQuaternion;
}
}
void Start ()
{
// Make the rigid body not change rotation
if (rigidbody)
rigidbody.freezeRotation = true;
originalRotation = transform.localRotation;
}
public static float ClampAngle (float angle float min float max)
{
if (angle < -360F)
angle += 360F;
if (angle > 360F)
angle -= 360F;
return Mathf.Clamp (angle min max);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3654 2009-08-23 16:05 SoccerGame015\SoccerGame\Assets\ob
文件 3818 2009-08-23 16:05 SoccerGame015\SoccerGame\Assets\ob
文件 3824 2009-08-23 16:06 SoccerGame015\SoccerGame\Assets\ob
文件 3654 2009-08-23 16:06 SoccerGame015\SoccerGame\Assets\ob
文件 3858 2009-08-22 18:42 SoccerGame015\SoccerGame\Assets\ob
文件 4277 2009-08-23 16:04 SoccerGame015\SoccerGame\Assets\ob
文件 3662 2009-08-23 00:15 SoccerGame015\SoccerGame\Assets\ob
文件 3662 2009-08-23 00:15 SoccerGame015\SoccerGame\Assets\ob
文件 3662 2009-08-23 00:15 SoccerGame015\SoccerGame\Assets\ob
文件 3662 2009-08-23 00:15 SoccerGame015\SoccerGame\Assets\ob
文件 3686 2009-09-07 20:32 SoccerGame015\SoccerGame\Assets\ob
文件 144928 2009-08-22 20:38 SoccerGame015\SoccerGame\Assets\ob
文件 142432 2009-08-22 19:05 SoccerGame015\SoccerGame\Assets\ob
文件 133788 2009-08-22 18:39 SoccerGame015\SoccerGame\Assets\ob
文件 126108 2009-08-22 00:41 SoccerGame015\SoccerGame\Assets\ob
文件 492184 2009-08-23 20:04 SoccerGame015\SoccerGame\Assets\ob
文件 492184 2009-08-23 19:53 SoccerGame015\SoccerGame\Assets\ob
文件 70 2009-08-22 20:42 SoccerGame015\SoccerGame\Assets\ob
文件 70 2009-08-22 18:06 SoccerGame015\SoccerGame\Assets\ob
文件 3822 2009-08-19 16:55 SoccerGame015\SoccerGame\Assets\ob
文件 8301 2009-08-22 01:07 SoccerGame015\SoccerGame\Assets\ob
..A.SH. 10752 2009-08-23 20:20 SoccerGame015\SoccerGame\Assets\ob
文件 70 2009-08-22 18:37 SoccerGame015\SoccerGame\Assets\ob
文件 1307 2011-08-02 14:51 SoccerGame015\SoccerGame\Assets\ob
文件 174058 2009-09-28 19:36 SoccerGame015\SoccerGame\Assets\Scenes\TheGame.unity
文件 2162 2009-09-28 19:04 SoccerGame015\SoccerGame\Assets\sc
文件 823 2009-09-27 23:01 SoccerGame015\SoccerGame\Assets\sc
文件 1121 2009-09-28 19:31 SoccerGame015\SoccerGame\Assets\sc
文件 1561 2009-08-16 19:07 SoccerGame015\SoccerGame\Assets\sc
文件 4592 2009-09-27 22:52 SoccerGame015\SoccerGame\Assets\sc
............此处省略475个文件信息
- 上一篇:GNSS-Viewer用户手册.rev0.2
- 下一篇:酒店管理系统论文和程序
相关资源
- SimplePath 1.11(最新完整版)
- leapmotion拼图
- unity3d rain 下雨 效果 特效 package
- unity3d分屏效果
- 帽子接球-Unity3D-源码及详细文档
- Water+2D+Kit+v1.1
- unity传送门特效粒子
- Unity3D 旋转相机视角 镜头缩放 拖动相
- 基于Unity3D多人斗地主毕设论文
- 水面效果插件TasharenWater.zip
- RunnerHorizonBendingDiffuse By SqueakyOak
- 棍子英雄Unity3D源码
- 直升机模型unity3d
- Unity3dObfuscatorSetup.rar
- 打地鼠游戏资源以及源代码
- 汽车发动机unity模型包
- Unity3D 10个漂亮的天空盒子
- Unity3D实现的角色攻击、移动待机死亡
- 基于Unity3d局域网下可联机运行的坦克
- Unity3D 室内小场景搭建(抓取、抛扔物
- Unity3D制作的2D游戏[含项目源码]
- unity3d 带有履带效果的坦克
- unity Magica Cloth.1.7.0.zip
- Unity3D 轻松回放插件 EZReplayManager V1.
- Unity3D给力材质包
- unity3d太空射击游戏源码修改后的
- 拼图小游戏.zip
- Unity3D游戏开发vr插件CardboardSDKForUnit
- Unity3D 2018 最新最全800个脚本教程
- 赛车游戏 unity3d
评论
共有 条评论