资源简介
Unity3D海面效果(不错的学习资料),需要朋友请下载,如果是比较高的unity3d版本需要转换后才能使用
代码片段和文件信息
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 OnGUI()
{
GUI.Label(new Rect(20 Screen.height-30 500 20) “Hold RMB or LMB to activate camera control. WASD for movement LShift for speedboost“);
}
void Update ()
{
if (!Input.GetMouseButton(1) && !Input.GetMouseButton(0))
return;
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;
}
float multiplier = 1.0f;
if (Input.GetKey(KeyCode.LeftShift))
multiplier = 5.0f;
Vector3 pos = transform.position;
pos += (transform.forward * Input.GetAxis(“Vertical“) + transform.right * Input.GetAxis(“Horizontal“)) * Time.deltaTime * 50.0f * multiplier;
transform.position = pos;
}
void Start ()
{
// Make the rigid body not change rotation
if (rigidbody)
rigidbody.freezeRotatio
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6148 2009-05-13 20:22 Ocean(1)\Ocean\.DS_Store
文件 6148 2009-05-13 20:22 Ocean(1)\Ocean\Assets\.DS_Store
文件 9850 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Boyantob
文件 815166 2007-10-07 21:06 Ocean(1)\Ocean\Assets\Grass&Rock.psd
文件 1275 2009-05-13 13:36 Ocean(1)\Ocean\Assets\KnownIssues.txt
文件 3253 2009-05-13 13:54 Ocean(1)\Ocean\Assets\MouseLook.cs
文件 2474099 2009-04-04 02:33 Ocean(1)\Ocean\Assets\New Terrain.asset
文件 1431 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Ocean Sources\Boyancy.js
文件 297328 2009-01-28 22:49 Ocean(1)\Ocean\Assets\Ocean Sources\Ocean Cubemap.cubemap
文件 1853116 2009-01-25 23:24 Ocean(1)\Ocean\Assets\Ocean Sources\Ocean foam.tif
文件 4165 2009-05-12 21:56 Ocean(1)\Ocean\Assets\Ocean Sources\Ocean Material.mat
文件 30472 2010-05-20 15:18 Ocean(1)\Ocean\Assets\Ocean Sources\Ocean.js
文件 4446 2009-01-28 22:48 Ocean(1)\Ocean\Assets\Ocean Sources\Ocean.shader
文件 8052 2009-04-04 02:33 Ocean(1)\Ocean\Assets\Ocean.prefab
文件 1976 2009-03-31 11:10 Ocean(1)\Ocean\Assets\Plugins\CameraHelper.cs
文件 15815 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\Complex.cs
文件 22179 2009-05-12 21:06 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\ComplexArray.cs
文件 15349 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\ComplexF.cs
文件 5150 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\ComplexMath.cs
文件 11426 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\ComplexStats.cs
文件 40798 2009-05-12 21:07 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\Fourier.cs
文件 2273 2009-01-24 13:09 Ocean(1)\Ocean\Assets\Plugins\Exocortex_FFT\FourierDirection.cs
文件 2706 2009-05-12 23:04 Ocean(1)\Ocean\Assets\Plugins\WaterPostEffect.cs
文件 4104 2008-07-02 14:16 Ocean(1)\Ocean\Assets\Pro Standard Assets\Glass Refraction\FX-Refractive.mat
文件 3001 2009-01-19 14:46 Ocean(1)\Ocean\Assets\Pro Standard Assets\Glass Refraction\Glass-Stained-BumpDistort.shader
文件 748 2009-01-19 14:46 Ocean(1)\Ocean\Assets\Pro Standard Assets\Glass Refraction\Glass-Stained-BumpSpecDistort.shader
文件 377814 2008-07-02 14:16 Ocean(1)\Ocean\Assets\Pro Standard Assets\Glass Refraction\glass.tif
文件 636536 2008-07-02 14:16 Ocean(1)\Ocean\Assets\Pro Standard Assets\Glass Refraction\glassbump.tif
文件 4819 2009-01-19 14:46 Ocean(1)\Ocean\Assets\Pro Standard Assets\Image ba
文件 77 2008-07-02 14:16 Ocean(1)\Ocean\Assets\Pro Standard Assets\Image ba
............此处省略620个文件信息
- 上一篇:tomcat-8.0.47
- 下一篇:sequelpro-1.1.2
评论
共有 条评论