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
//taken from http://answers.unity3d.com/questions/1097270/project-a-vector3-onto-a-plane-orthographically.html | |
//You simply project your vector onto the normal and subtract the result from your original vector. That will give you the projected vector on the plane. If you want to project a point to a plane you first need to calculate the relative vector from a point on that plane. | |
Vector3 planeOrigin; | |
Vector3 planeNormal; | |
Vector3 point; | |
Vector3 v = point - planeOrigin; | |
Vector3 d = Vector3.Project(v, planeNormal.normalized); | |
Vector3 projectedPoint = point - d; |
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
# Create a memory cgroup named 'mygroup', allowing $USER to change the parameters and run tasks in the cgroup. | |
sudo cgcreate -a $USER -t $USER -g memory:mygroup | |
# Set the memory limit to 10MB | |
echo 10000000 > /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes | |
# Run a program in the cgroup | |
cgexec -g memory:mygroup ls |
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
float AngleBetweenVector2(Vector2 vec1, Vector2 vec2) | |
{ | |
Vector2 diference = vec2 - vec1; | |
float sign = (vec2.y < vec1.y)? -1.0f : 1.0f; | |
return Vector2.Angle(Vector2.right, diference) * sign; | |
} | |
float cosAngleBetweenVector3(Vector3 vec1, Vector3, vec2) | |
{ | |
float dot = Vector3.Dot(vec1,vec2); |
NewerOlder