原创 unity3d:物體尋路貼合地面,y軸與地面normal方向平行(坦克爬斜坡問題)
坦克在爬斜坡時,保持坦克是貼合地面前進 尋路掛在父物體上,控制姿態腳本掛在坦克子物體上 RaycastHit hit; int Rmask = LayerMask.GetMask ("Terrain"); Vector3 Poi
原创 unity3d:shader自發光透明
Shader "Custom/AlphaSelfIllum" { Properties { _Color ("Main Color", Color) = (1,1,1,0) _SpecColor ("S
原创 c#:winform讀取excel,並顯示在griddataview
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.Ole
原创 unity3d:terrain地形數據拷貝,包含樹和草的信息
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TerrianTest : MonoBehavi
原创 C#:圖片加上文字水印(書法印章生成)
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO;
原创 unity3d:process 進程調用C#控制檯程序,並獲得輸出。傳入參數有空格要加""
public static Process StartProcess(string fileName,string args) { try { fileName = "\
原创 unity3d:向量計算:獲得兩點連線的垂直向量,判斷目標方位(前後左右)
獲得兩點連線垂直向量 /// <summary> /// 獲取某向量的垂直向量 /// </summary> public static Vector3 GetVerticalDir(Vector3 _dir)
原创 unity3d:限制物體旋轉角度(限制相機上下觀察角度)
因爲對於旋轉來說。360度是一個循環。-1° 也可以算是就是359° 而且unity就是這樣認爲的。面板上雖然顯示的是-1。但是他運行時是359。 if(angle>60) transform.eulerAngles = new Ve
原创 unity3d:保持V字型隊形,按路徑點移動
思路: 1.分爲領導者,追隨者,追隨點。 2.先創建領導者。根據剩下人數的多少,再在左右創建追隨者和追隨點,成v字排列。追隨點是領導者的子物體 3.領導者按照路徑點移動 4.追隨者追的追隨點移動,如果距離過遠,要提高速度 創建隊形腳本
原创 unity3d:android導出項目編譯Multiple dex files define Lcom/unity3d/player/UnityPlayerActivity
一般是.jar .aar包重複。導入不同版本插件,.aar位置不同,或者是產生了.aar.skip這樣的文件
原创 unity3d:dotween pingpong 物體來回運動
using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; public class PingP
原创 unity3d:htcvive vrtk獲取手柄的速度
方案1:VRTK原生api方式 void CtrlReferInit1() { m_leftCtrlRefer = VRTK_ControllerReference.GetControllerRefer
原创 unity3d:htcvive禁止頭顯定位,但不限制角度
過山車,導遊模式,或者推動玩家前進,禁止玩家移動,但是不限制觀察角度 using System.Collections; using UnityEngine; using UnityEngine.XR; public class B
原创 unity3d:路徑點移動,使用dotween(模擬蝴蝶飛舞)
設置路徑點 using UnityEngine; using System.Collections; using System.Collections.Generic; public class WaypointsManager :
原创 unity3d:運動殘影
Shader "Custom/GhostOnly_Transparent" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _GhostColor ("G