最新unity学习资料大全.doc
《最新unity学习资料大全.doc》由会员分享,可在线阅读,更多相关《最新unity学习资料大全.doc(137页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateunity学习资料大全unity学习资料大全关于路径跟随设置点形成路径控制物体运动:用过Torque3D的人都知道,在这个引擎中可以在编辑模式下设定路径 然后AI就会按照这个路径运动,现在unity3D也可以啦 分享给大家 希望能有点帮助总共3个文件把第一个个文件放在新建的gameobject上 例如cube,然后creat empty创建空object作为splin
2、eparent,再创建4个或者多个sphere1,2,3,4作为它的子物体,然后将splineparent拖到这个代码var SplineParent : GameObject中,最后会看到cube按照sphere1到4的顺序运动JavaScript - SplineController.jsenum eOrientationMode NODE = 0, TANGENT var SplineParent : GameObject;var Duration : float = 10.0;var OrientationMode : eOrientationMode = eOrientationMo
3、de.NODE;var WrapMode : eWrapMode = eWrapMode.ONCE;var AutoStart : boolean = true;var AutoClose : boolean = true;var HideOnExecute : boolean = true;private var mSplineInterp : SplineInterpolator = null;private var mTransforms : Array = null;script AddComponentMenu(Splines/Spline Controller)function O
4、nDrawGizmos() var trans : Array = GetTransforms(); if (trans.length 2) return; var interp = new SplineInterpolator(); SetupSplineInterpolator(interp, trans); interp.StartInterpolation(null, false, WrapMode); var prevPos : Vector3 = trans0.position; for (c=1; c = 100; c+) var currTime:float = c * Dur
5、ation / 100.0; var currPos = interp.GetHermiteAtTime(currTime); var mag:float = (currPos-prevPos).magnitude * 2.0; Gizmos.color = Color(mag, 0.0, 0.0, 1.0); Gizmos.DrawLine(prevPos, currPos); prevPos = currPos; function Start() mSplineInterp = gameObject.AddComponent(SplineInterpolator); mTransforms
6、 = GetTransforms(); if (HideOnExecute) DisableTransforms(); if (AutoStart) FollowSpline();function SetupSplineInterpolator(interp:SplineInterpolator, trans:Array) : void interp.Reset(); if (AutoClose) var step : float = Duration / trans.length; else step = Duration / (trans.length-1); for (var c:int
7、 = 0; c 0) SetupSplineInterpolator(mSplineInterp, mTransforms); mSplineInterp.StartInterpolation(null, true, WrapMode); JavaScript - SplineInterpolator.jsenum eEndPointsMode AUTO = 0, AUTOCLOSED, EXPLICIT enum eWrapMode ONCE = 0, LOOP private var mEndPointsMode = eEndPointsMode.AUTO;class SplineNode
8、 var Point : Vector3; var Rot : Quaternion; var Time : float; var EaseIO : Vector2; function SplineNode(p:Vector3, quaternion, t:float, io:Vector2) Point=p; Rot=q; Time=t; EaseIO=io; function SplineNode(o : SplineNode) Point=o.Point; Rot=o.Rot; Time=o.Time; EaseIO=o.EaseIO; private var mNodes : Arra
9、y = null;private var mState : String = ;private var mRotations : boolean = false;private var mOnEndCallback:Object;function Awake() Reset();function StartInterpolation(endCallback : Object, bRotations : boolean, mode : eWrapMode) if (mState != Reset) throw First reset, add points and then call here;
10、 mState = mode = eWrapMode.ONCE? Once : Loop; mRotations = bRotations; mOnEndCallback = endCallback; SetInput();function Reset() mNodes = new Array(); mState = Reset; mCurrentIdx = 1; mCurrentTime = 0.0; mRotations = false; mEndPointsMode = eEndPointsMode.AUTO;function AddPoint(pos : Vector3, quat :
11、 Quaternion, timeInSeconds : float, easeInOut : Vector2) if (mState != Reset) throw Cannot add points after start; mNodes.push(SplineNode(pos, quat, timeInSeconds, easeInOut);function SetInput() if (mNodes.length 2) throw Invalid number of points; if (mRotations) for (var c:int = 1; c Selective nega
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 unity 学习 资料 大全
限制150内