<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unity &#8211; ChaBug安全</title>
	<atom:link href="/tags/unity/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>一个分享知识、结识伙伴、资源共享的博客</description>
	<lastBuildDate>Mon, 02 Apr 2018 09:07:28 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.5</generator>
	<item>
		<title>Unity动画正播倒播</title>
		<link>/code/393.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Mon, 02 Apr 2018 09:07:28 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[Unity]]></category>
		<guid isPermaLink="false">/?p=322</guid>

					<description><![CDATA[用的是Animation的动画 所以动画Debug模式下的Legacy选项要勾上。 using UnityEngine; using System.Collections; pub...]]></description>
										<content:encoded><![CDATA[<p>用的是Animation的动画 所以动画Debug模式下的Legacy选项要勾上。</p>
<pre><code>using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
    private Animation libai;
    void Start () {
        libai = gameObject.GetComponent ();
        PlayAni ();
    }
    void PlayAni(){
        libai [&quot;test&quot;].time = 0;
        libai [&quot;test&quot;].speed = 1;
        libai.Play ();
        StartCoroutine (&quot;PlayBack&quot;);
    }
    IEnumerator PlayBack(){
        yield return new WaitForSeconds (2);
        libai [&quot;test&quot;].time = libai [&quot;test&quot;].clip.length;
        libai [&quot;test&quot;].speed = -1;
        libai.Play ();
    }
}
</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unity Animator is not playing a Playable问题</title>
		<link>/code/391.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 01 Apr 2018 14:52:56 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[解决方法]]></category>
		<guid isPermaLink="false">/?p=320</guid>

					<description><![CDATA[解决方法 The problem was that in my code I was referencing the Animator component on the prefa...]]></description>
										<content:encoded><![CDATA[<p><span class="wpcom_tag_link"><a href="/tags/%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95" title="解决方法" target="_blank">解决方法</a></span></p>
<pre><code>The problem was that in my code I was referencing the Animator component on the prefab, not the instantiation of it.</code></pre>
<p>意思就是不能在预制体上用Animator组件，换成模型就好了。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unity中UGUI实现技能冷却</title>
		<link>/code/387.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Mon, 26 Mar 2018 09:55:59 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[代码]]></category>
		<guid isPermaLink="false">/?p=316</guid>

					<description><![CDATA[直接贴代码 using UnityEngine; using System.Collections; using UnityEngine.UI; public class Test...]]></description>
										<content:encoded><![CDATA[<p>直接贴<span class="wpcom_tag_link"><a href="/tags/%e4%bb%a3%e7%a0%81" title="代码" target="_blank">代码</a></span></p>
<pre><code>using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TestFiled : MonoBehaviour
{
    private Image m_image;
    //冷却时间
    public float time=2;
    void Start ()
    {
        m_image = this.GetComponent ();
        //设置图片类型为filed
        m_image.type=Image.Type.Filled;
        //设置图片填充方法
        m_image.fillMethod=Image.FillMethod.Radial360;
        //设置初始填充位置
        m_image.fillOrigin=2;
        //填充比例
        m_image.fillAmount=0;
    }
    void Update ()
    {
        //如果填充比例小于1</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>动画系统Macanim笔记</title>
		<link>/code/385.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Fri, 23 Mar 2018 19:12:40 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[笔记]]></category>
		<guid isPermaLink="false">/?p=308</guid>

					<description><![CDATA[Character Controller Character Controller 可以让角色“动起来”的常用组件有三个：Transform，Rigidbody，Character...]]></description>
										<content:encoded><![CDATA[<h1>Character Controller</h1>
<ol>
<li>Character Controller</li>
</ol>
<p>可以让角色“动起来”的常用组件有三个：Transform，Rigidbody，Character Controller<br />角色控制器也属于物理组件，它的位置在：<br />Component- &gt;Physics- &gt;Character Controller<br />角色控制器主要用于第三人称或者第一人称游戏主角(人形为主)控制。</p>
<ol>
<li>控制角色移动<br />SimpleMove（Vector3）：简单移动</li>
</ol>
<p>以一定的速度移动角色，会自动应用重力。<br />[角色控制器不是刚体，但是具备刚体的一些属性]<br /> Move（Vector3）：移动<br />更为复杂的一种运动，每次都绝对运动，不会应用重力。</p>
<p>水平：Horizontal，对应 AD 键，以及方向键的←和→。<br />垂直：Vertical，对应 WS 键，以及方向键的↑和↓。<br />轴向有返回值的，范围为-1 ~ 0 ~ 1。根据按键的力度返回相应的值。<br />4.取得轴向的值<br />Input.GetAxis（“轴向名称”）;</p>
<pre><code>float horizontal=Input.GetAxis(&quot;Horizontal&quot;);
float vertical = Input.GetAxis (&quot;Vertical&quot;);
//具有刚体的一些属性的简单移动
m_CC.SimpleMove ((new Vector3 (horizontal, 0, vertical))*3);
//移动 不会掉落
m_CC.Move ((new Vector3 (horizontal, 0, vertical))*0.333f);
</code></pre>
<h1>角色控制器属性讲解</h1>
<ol>
<li>Slope Limit</li>
</ol>
<p>斜率限制，控制角色最大的爬坡斜度。[演示：角色爬坡]</p>
<ol>
<li>Step Offset</li>
</ol>
<p>台阶高度，控制角色可以迈上最大的台阶高度。[演示：角色上台阶]</p>
<ol>
<li>Skin Width [默认即可]</li>
</ol>
<p>皮肤厚度，在角色的外围包裹着一层“皮肤”，设置这层皮肤的厚度。<br />数值调大，最明显的就是角色和地面之间的间距变大，也就是角色皮肤变厚了。</p>
<ol>
<li>Min Move Distance [默认即可]</li>
</ol>
<p>最小移动距离，默认是 0.001，也就是 1 毫米。<br />如果该数值调大，但<span class="wpcom_tag_link"><a href="/tags/%e4%bb%a3%e7%a0%81" title="代码" target="_blank">代码</a></span>中单位移动速度很慢，角色就不会动。</p>
<ol>
<li>Center/Radius/Height</li>
</ol>
<p>角色控制器组件在 Scene 面板中体现为一个“胶囊碰撞器”的形状。<br />Center：控制中心点的位置；<br />Radius：控制半径；<br />Height：控制高度。</p>
<blockquote><p>小技巧：在 Game 面板将 Gizmos 设置为选中状态，可以在运行状态看到组<br />件的图标，方便运行过程中对组件进行调试。</p></blockquote>
<h2>方法</h2>
<pre><code>void OnControllerColliderHit(ControllerColliderHit hit){
    Debug.Log (hit.gameObject.name);
}
</code></pre>
<h1>Apply Root Motion</h1>
<p>勾选上之后，如果动画有位移，则真的发生位移。</p>
<h1>动画过渡延迟</h1>
<p>把过渡线上的Has Exit Time勾掉即可马上过渡。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unity3D之float Input.GetAxis(string axisname)</title>
		<link>/code/383.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Thu, 22 Mar 2018 11:07:19 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[笔记]]></category>
		<guid isPermaLink="false">/?p=306</guid>

					<description><![CDATA[从像这样的脚本，可以查询当前状态： value = Input.GetAxis (&#34;Horizontal&#34;);一个轴具有-1和1之间的值。中间位置为0。这种情况...]]></description>
										<content:encoded><![CDATA[<p>从像这样的脚本，可以查询当前状态：</p>
<p><code>value = Input.GetAxis (&quot;Horizontal&quot;);</code><br />一个轴具有-1和1之间的值。中间位置为0。这种情况用于操纵杆输入和键盘输入。</p>
<p>然而，鼠标增量和Window Shake增量是鼠标或窗口从上一帧到现在的移动。这意思是当用户快速移动鼠标时，它可能大于1或小于-1。</p>
<p>参数内容如下:</p>
<p>1.触屏类：</p>
<p>MouseX       鼠标按着并沿着屏幕X轴方向滑动时触发</p>
<p>MouseY       鼠标按着并沿着屏幕Y轴方向滑动时触发</p>
<p>Mouse ScrollWheel      当鼠标滚动轮滚动时触发</p>
<p>2.键盘操作类：</p>
<p>1.Vertical      对应键盘上面的上下箭头，当按下上或下箭头时触发</p>
<p>2.Horizontal    对应键盘上面的左右箭头，当按下左或右箭头时触发</p>
<pre><code>    using UnityEngine;
    using System.Collections;
    public class example :Monobehaviour {
        public float speed = 10.0F;
        public float rotationSpeed = 100.0F;
        void Update() {
            float translation = Input.GetAxis(&quot;Vertical&quot;) * speed;
            float rotation = Input.GetAxis(&quot;Horizontal&quot;) * rotationSpeed;
            translation *= Time.deltaTime;
            rotation *= Time.deltaTime;
            transform.Translate(0, 0, translation);
            transform.Rotate(0, rotation, 0);
        }
    }</code></pre>
<pre><code>// A very simplistic car driving on the x-z plane.
// 一个十分简单的在x-z平面的驾车例子
var speed : float = 10.0;
var rotationSpeed : float = 100.0;
function Update () {
    // Get the horizontal and vertical axis.
    //获取横向和纵向坐标轴
    // By default they are mapped to the arrow keys.
    //默认情况下他们关联到方向键上
    // The value is in the range -1 to 1
    //值的范围是在-1到1之间
    var translation : float = Input.GetAxis (&quot;Vertical&quot;) * speed;
    var rotation : float = Input.GetAxis (&quot;Horizontal&quot;) * rotationSpeed;
    // Make it move 10 meters per second instead of 10 meters per frame...
    // 使它每帧移动10米变为每秒移动10米...
    translation *= Time.deltaTime;
    rotation *= Time.deltaTime;
    // Move translation along the object's z-axis
    //沿着z轴平移对象
    transform.Translate (0, 0, translation);
    // Rotate around our y-axis
    //以我们的y轴为中心旋转</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unity基础笔记</title>
		<link>/code/379.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sat, 17 Mar 2018 23:38:00 +0000</pubDate>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[笔记]]></category>
		<guid isPermaLink="false">/?p=287</guid>

					<description><![CDATA[最近参加省比赛，临时学的Unity，整理一份笔记。移步 https://book.chabug.org/unitybi-ji.html]]></description>
										<content:encoded><![CDATA[<blockquote><p>最近参加省比赛，临时学的<span class="wpcom_tag_link"><a href="/tags/unity" title="Unity" target="_blank">Unity</a></span>，整理一份<span class="wpcom_tag_link"><a href="/tags/%e7%ac%94%e8%ae%b0" title="笔记" target="_blank">笔记</a></span>。<br />移步 <a href="https://book.chabug.org/unitybi-ji.html">https://book.chabug.org/unitybi-ji.html</a></p></blockquote>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
