This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://forum.unity.com/threads/how-to-compute-vertex-rotation.470676/ | |
| inline float3x3 xRotation3dRadians(float rad) { | |
| float s = sin(rad); | |
| float c = cos(rad); | |
| return float3x3( | |
| 1, 0, 0, | |
| 0, c, s, | |
| 0, -s, c); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class QuadTreeTest : MonoBehaviour { | |
| public class TestObject : IQuadTreeObject{ | |
| private Vector3 m_vPosition; | |
| public TestObject(Vector3 position){ | |
| m_vPosition = position; | |
| } | |
| public Vector2 GetPosition(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To combine two bytes into a single integer using bit shifting, | |
| you can shift one of the bytes by 8 bits (which equals one byte) | |
| //= BINRSHIFT(number, shift_value) | |
| same as | |
| = number/(2^shift_value) | |
| same as | |
| //=BINLSHIFT(number, shift_value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // command | |
| npm install discord.io winston --save | |
| // error | |
| npm http GET https://registry.npmjs.org/winston npm ERR! Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY | |
| // solution | |
| npm config set strict-ssl=false | |
| -------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void vert(inout appdata_full v, out Input o) | |
| { | |
| UNITY_INITIALIZE_OUTPUT(Input, o); | |
| // get the camera basis vectors | |
| float3 forward = -normalize(UNITY_MATRIX_V._m20_m21_m22); | |
| float3 up = float3(0, 1, 0); //normalize(UNITY_MATRIX_V._m10_m11_m12); | |
| float3 right = normalize(UNITY_MATRIX_V._m00_m01_m02); | |
| // rotate to face camera |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // https://forum.unity.com/threads/line-intersection.17384/#post-4442284 | |
| bool FasterLineSegmentIntersection (Vector2 line1point1, Vector2 line1point2, Vector2 line2point1, Vector2 line2point2) { | |
| Vector2 a = line1point2 - line1point1; | |
| Vector2 b = line2point1 - line2point2; | |
| Vector2 c = line1point1 - line2point1; | |
| float alphaNumerator = b.y * c.x - b.x * c.y; | |
| float betaNumerator = a.x * c.y - a.y * c.x; | |
| float denominator = a.y * b.x - a.x * b.y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| asdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // send parameter to thread method | |
| Thread myThread; | |
| ParameterizedThreadStart start = new ParameterizedThreadStart(YourMethod); | |
| myThread = new Thread(start); | |
| myThread.IsBackground = true; | |
| myThread.Start(yourParams); | |
| void YourMethod(System.Object a) | |
| { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // https://forum.unity.com/threads/unity-5-6-1-video-player-url-youtube-support.483115/#post-3938095 | |
| //Returns the json data containing the individual url for individual video quality files | |
| header('Access-Control-Allow-Origin: *'); | |
| header('Content-Type: application/json'); | |
| if(isset($_POST['url']) && $_POST['url'] != ""){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WriteableBitmap canvasBitmap; | |
| Image drawingImage; | |
| .. | |
| // create texture | |
| drawingImage = imgCanvas; // this is image component in wpf | |
| RenderOptions.SetBitmapScalingMode(drawingImage, BitmapScalingMode.NearestNeighbor); | |
| RenderOptions.SetEdgeMode(drawingImage, EdgeMode.Aliased); | |
| w = (MainWindow)Application.Current.MainWindow; |