This file contains 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; | |
using System.Runtime.InteropServices; | |
using System; | |
public class ChangeMouseSpeed : MonoBehaviour { | |
public const uint SPI_SETMOUSESPEED = 0x0071; | |
public const uint SPI_GETMOUSESPEED = 0x0070; |
This file contains 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
for item in bpy.context.scene.objects: | |
bpy.context.scene.objects.unlink(item) | |
for item in bpy.data.objects: | |
bpy.data.objects.remove(item) | |
for item in bpy.data.meshes: | |
bpy.data.meshes.remove(item) | |
for item in bpy.data.materials: |
This file contains 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
import bpy | |
import random | |
def offset_vertices_of_mesh_objects (vertOffsetRnd_): | |
for obj in bpy.context.scene.objects: | |
#print(obj.type) | |
if obj.type == 'MESH': | |
print(obj.name) | |
for vert in obj.data.vertices: |
This file contains 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
def get_keyframes(action_name): | |
keyframes = [] | |
action = bpy.data.actions[action_name] | |
if action is not None and action is not None: | |
for fcu in action.fcurves: | |
for keyframe in fcu.keyframe_points: | |
x, y = keyframe.co | |
if x not in keyframes: | |
keyframes.append((math.ceil(x))) | |
return keyframes |
This file contains 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 calcDistancePointAndPlane (Vector3 p, Vector3 v0, Vector3 v1, Vector3 v2) { | |
Vector3 n = Vector3.Normalize (Vector3.Cross (v1 - v0, v2 - v1)); | |
Vector3 g = (v0 + v1 + v2) / 3.0f; | |
return Mathf.Abs (Vector3.Dot (n, p - g)); | |
} |
This file contains 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
Vector3 calcIntersectionLineSegmentAndPlane (Vector3 a, Vector3 b, Vector3 v0, Vector3 v1, Vector3 v2) { | |
float distAP = calcDistancePointAndPlane (a, v0, v1, v2); | |
float distBP = calcDistancePointAndPlane (b, v0, v1, v2); | |
float t = distAP / (distAP + distBP); | |
return (b - a) * t + a; | |
} |
This file contains 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
/// <summary> | |
/// ポリゴン上に点が含まれるかを判定 | |
/// </summary> | |
bool detectPointIsEnclosedByPolygon (Vector3 p, Vector3 v0, Vector3 v1, Vector3 v2) { | |
Vector3 n = Vector3.Normalize (Vector3.Cross (v1 - v0, v2 - v1)); | |
Vector3 n0 = Vector3.Normalize (Vector3.Cross (v1 - v0, p - v1)); | |
Vector3 n1 = Vector3.Normalize (Vector3.Cross (v2 - v1, p - v2)); | |
Vector3 n2 = Vector3.Normalize (Vector3.Cross (v0 - v2, p - v0)); |
This file contains 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
// ------------------------------------------------------------- | |
/// <summary> | |
/// 3次元座標上の線分と3角ポリゴンが交差してるかを判定 | |
/// </summary> | |
bool detectIsIntersectedLineSegmentAndPolygon (Vector3 a, Vector3 b, Vector3 v0, Vector3 v1, Vector3 v2) { | |
bool bCollision = detectCollisionLineSegmentAndPlane (a, b, v0, v1, v2); | |
if (bCollision) { | |
Vector3 p = calcIntersectionLineSegmentAndPlane (a, b, v0, v1, v2); |
This file contains 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; | |
using Windows.Kinect; | |
public class DepthMapGenerator : MonoBehaviour { | |
public GameObject depthSourceManager; | |
private DepthSourceManager depthSourceManagerScript; | |
[Range (1, 8000)] |
OlderNewer