100+ results for 'vector3 .cs'
Not the results you expected?
UIFilledSprite.cs (https://bitbucket.org/adiq94/villageposition.git) C# · 466 lines
189 #if UNITY_3_5_4
190 override public void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color> cols)
191 #else
192 override public void OnFill (BetterList<Vector3> verts, BetterList<Vector2> uvs, BetterList<Color32> cols)
334 float v = Mathf.Lerp(uv[0].y, uv[2].y, ouv[b].y);
336 verts.Add(new Vector3(x, y, 0f));
337 uvs.Add(new Vector2(u, v));
338 cols.Add(col);
349 float v = Mathf.Lerp(uv[0].y, uv[2].y, ouv[b].y);
351 verts.Add(new Vector3(x, y, 0f));
352 uvs.Add(new Vector2(u, v));
353 cols.Add(col);
ArcBallCamera.cs (https://bitbucket.org/tomas_vahalik/straiki-game-engine.git) C# · 266 lines
46 }
48 public ArcBallCamera(GameScreen parent, Vector3 position, Vector3 target, float zoom) : base(parent, position, target)
49 {
50 Zoom = zoom;
83 }
85 private readonly Vector3 _destination = new Vector3(140,0,205);
86 private Vector3 _camStep;
178 var right = Vector3.Normalize(LookAt - ArcPosition); //calculate forward
179 right = Vector3.Cross(right, Vector3.Up); //calculate the real right
180 right.Y = 0;
181 right.Normalize();
190 public void MoveCameraForward(float amount)
191 {
192 Vector3 forward = Vector3.Normalize(LookAt - ArcPosition);
193 forward.Y = 0;
194 forward.Normalize();
Tutorial.cs (https://bitbucket.org/kstewart83/opentk-course.git) C# · 115 lines
SteamVR_LaserPointer.cs (https://bitbucket.org/RaptorGrease/vrprojekti.git) C# · 141 lines
34 holder = new GameObject();
35 holder.transform.parent = this.transform;
36 holder.transform.localPosition = Vector3.zero;
37 holder.transform.localRotation = Quaternion.identity;
39 pointer = GameObject.CreatePrimitive(PrimitiveType.Cube);
40 pointer.transform.parent = holder.transform;
41 pointer.transform.localScale = new Vector3(thickness, thickness, 100f);
42 pointer.transform.localPosition = new Vector3(0f, 0f, 50f);
131 if (controller != null && controller.triggerPressed)
132 {
133 pointer.transform.localScale = new Vector3(thickness * 5f, thickness * 5f, dist);
134 }
135 else
136 {
137 pointer.transform.localScale = new Vector3(thickness, thickness, dist);
138 }
139 pointer.transform.localPosition = new Vector3(0f, 0f, dist/2f);
NewEasyRoads3D.cs (https://bitbucket.org/vhsousa/edj-asterix-obelix-roman-defense.git) C# · 156 lines
8 {
9 private static NewEasyRoads3D instance;
10 private Vector3 scroll;
11 public GUISkin cGS;
12 public GUISkin dGS;
99 instance.Close();
100 go.name = objectname;
101 go.transform.position = Vector3.zero;
102 RoadObjectScript script = go.GetComponent<RoadObjectScript>();
103 script.closedTrack = false;
ObjImporter.cs (https://bitbucket.org/Werring/unity-indusim.git) C# · 256 lines
16 private struct meshStruct
17 {
18 public Vector3[] vertices;
19 public Vector3[] normals;
24 public int[] faceVerts;
25 public int[] faceUVs;
26 public Vector3[] faceData;
27 public string name;
28 public string fileName;
40 populateMeshStruct(ref newMesh);
42 Vector3[] newVerts = new Vector3[newMesh.faceData.Length];
43 Vector2[] newUVs = new Vector2[newMesh.faceData.Length];
44 Vector3[] newNormals = new Vector3[newMesh.faceData.Length];
214 while (j < brokenString.Length && ("" + brokenString[j]).Length > 0)
215 {
216 Vector3 temp = new Vector3();
217 brokenBrokenString = brokenString[j].Split(splitIdentifier2, 3); //Separate the face into individual components (vert, uv, normal)
218 temp.x = System.Convert.ToInt32(brokenBrokenString[0]);
Map.cs (https://bitbucket.org/arcanosteam/arcanos.git) C# · 162 lines
84 }
86 public WorldObject Spawn(ulong guid, WorldObjectTemplate template, Vector3 pos)
87 {
88 return Spawn(guid, template, pos, Rotation.Zero);
89 }
90 public WorldObject Spawn(ulong guid, WorldObjectTemplate template, Vector3 pos, Rotation rot)
91 {
92 WorldObject wo = new WorldObject(guid, template, pos, rot);
94 return wo;
95 }
96 public Creature Spawn(ulong guid, CreatureTemplate template, Vector3 pos)
97 {
98 return Spawn(guid, template, pos, Rotation.Zero);
PanHandler.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 166 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="PanHandler.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
55 }
57 Vector3D delta3D = this.LastPoint3D.Value - thisPoint3D.Value;
58 this.Pan(delta3D);
68 /// The panning vector.
69 /// </param>
70 public void Pan(Vector3D delta)
71 {
72 if (!this.Controller.IsPanEnabled)
100 }
102 Vector3D delta3D = this.LastPoint3D.Value - thisPoint3D.Value;
103 this.Pan(delta3D);
BroadphaseInterface.cs (https://bitbucket.org/cjrgaming/bullet-noxna.git) C# · 77 lines
30 {
32 BroadphaseProxy CreateProxy(Vector3 aabbMin, Vector3 aabbMax, BroadphaseNativeType shapeType, Object userPtr, CollisionFilterGroups collisionFilterGroup, CollisionFilterGroups collisionFilterMask, IDispatcher dispatcher, Object multiSapProxy);
33 BroadphaseProxy CreateProxy(ref Vector3 aabbMin, ref Vector3 aabbMax, BroadphaseNativeType shapeType, Object userPtr, CollisionFilterGroups collisionFilterGroup, CollisionFilterGroups collisionFilterMask, IDispatcher dispatcher, Object multiSapProxy);
35 void DestroyProxy(BroadphaseProxy proxy, IDispatcher dispatcher);
36 void SetAabb(BroadphaseProxy proxy, ref Vector3 aabbMin, ref Vector3 aabbMax, IDispatcher dispatcher);
37 void GetAabb(BroadphaseProxy proxy, out Vector3 aabbMin, out Vector3 aabbMax);
39 void RayTest(ref Vector3 rayFrom, ref Vector3 rayTo, BroadphaseRayCallback rayCallback);
40 void RayTest(ref Vector3 rayFrom, ref Vector3 rayTo, BroadphaseRayCallback rayCallback, ref Vector3 aabbMin, ref Vector3 aabbMax);
41 void AabbTest(ref Vector3 aabbMin, ref Vector3 aabbMax, IBroadphaseAabbCallback callback);
48 ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
49 ///will add some transform later
50 void GetBroadphaseAabb(out Vector3 aabbMin, out Vector3 aabbMax);
52 ///reset broadphase internal structures, to ensure determinism/reproducability
TruncatedConeVisual3D.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 236 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="TruncatedConeVisual3D.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
40 public static readonly DependencyProperty NormalProperty = DependencyProperty.Register(
41 "Normal",
42 typeof(Vector3D),
43 typeof(TruncatedConeVisual3D),
44 new PropertyMetadata(new Vector3D(0, 0, 1), GeometryChanged));
129 /// </summary>
130 /// <value>The normal.</value>
131 public Vector3D Normal
132 {
133 get
134 {
135 return (Vector3D)this.GetValue(NormalProperty);
136 }
WonderGiftDlg.cs (https://bitbucket.org/MyongJu/decompile.git) C# · 128 lines
88 this.m_scrollView.movement = UIScrollView.Movement.Unrestricted;
89 this.m_scrollView.ResetPosition();
90 this.m_scrollView.currentMomentum = Vector3.zero;
91 this.m_scrollView.movement = UIScrollView.Movement.Horizontal;
92 }
110 GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.m_template.gameObject);
111 gameObject.transform.SetParent(this.m_container.transform);
112 gameObject.transform.localScale = Vector3.one;
113 gameObject.SetActive(true);
114 WonderGiftItem component = gameObject.GetComponent<WonderGiftItem>();
DataTypes.cs (https://bitbucket.org/kbengine/kbengine.git) C# · 496 lines
273 }
275 public class KBEDATATYPE_VECTOR3 : KBEDATATYPE_BASE
276 {
277 public override object createFromStream(MemoryStream stream)
280 if(3 != size)
281 {
282 Dbg.ERROR_MSG(string.Format("KBEDATATYPE_VECTOR3::createFromStream: size({0}) is error!", size));
283 }
285 return new Vector3(stream.readFloat(), stream.readFloat(), stream.readFloat());
286 }
PolarFlatBrickMap.cs (https://bitbucket.org/tomtominc/rainbogeddon.git) C# · 167 lines
22 /// {
23 /// grid = FlatHexGrid<TCell>.HorizontallyWrappedParallelogram(width, height);
24 /// map = new PolarFlatBrickMap(Vector3.zero, 10, 110, newRectPoint(5, 10).To3DXY();
25 ///
26 /// foreach (var point in grid)
31 /// }
32 ///
33 /// public void Click(Vector3 worldPoint)
34 /// {
35 /// var gridPoint = map[worldPoint]
NewBGCViewModel.cs (https://bitbucket.org/alexshtf/sketchmodeller.git) C# · 313 lines
265 }
267 protected override void PerformDrag(Vector dragVector2d, Vector3D vector3D, Vector3D axisDragVector, Point3D? currDragPosition)
268 {
269 if (Keyboard.Modifiers == ModifierKeys.None)
286 {
287 axis.Normalize();
288 var radiusDelta = 0.5 * Vector3D.DotProduct(axis, vector3D);
289 viewModel.Components = viewModel.RecomputeComponents(
290 viewModel.Components,
296 {
297 var axis = viewModel.Axis.Normalized();
298 var lengthDelta = Vector3D.DotProduct(axis, vector3D) * 2;
299 viewModel.Length = Math.Max(MIN_LENGTH, viewModel.Length + lengthDelta);
300 }
RotateManipulator.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 227 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="RotateManipulator.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
24 public static readonly DependencyProperty AxisProperty = DependencyProperty.Register(
25 "Axis",
26 typeof(Vector3D),
27 typeof(RotateManipulator),
28 new UIPropertyMetadata(new Vector3D(0, 0, 1), GeometryChanged));
73 /// </summary>
74 /// <value>The axis.</value>
75 public Vector3D Axis
76 {
77 get
78 {
79 return (Vector3D)this.GetValue(AxisProperty);
80 }
FMatrix.cs (https://bitbucket.org/ironpencil/tankfight.git) C# · 273 lines
StartEndModifier.cs (https://bitbucket.org/Werring/unity-indusim.git) C# · 171 lines
64 return;
65 } else if (p.vectorPath.Count < 2 && !addPoints) {
66 //Vector3[] arr = new Vector3[2];
67 //arr[0] = p.vectorPath[0];
68 //arr[1] = p.vectorPath[0];
112 } else {
114 //Vector3[] newPath = new Vector3[p.vectorPath.Length+(exactStartPoint != Exactness.SnapToNode ? 1 : 0) + (exactEndPoint != Exactness.SnapToNode ? 1 : 0)];
116 if (exactStartPoint != Exactness.SnapToNode) {
133 }
135 public Vector3 GetClampedPoint (Vector3 from, Vector3 to, Node hint) {
137 //float minDistance = Mathf.Infinity;
Game.cs (https://bitbucket.org/realityfoil/ld26-optimality.git) C# · 300 lines
53 public int baseHP;
54 [HideInInspector]
55 public Vector3[,] directionToMove;
57 private List<Spawner> spawners;
103 map = new Map(levels[level - 1]);
105 directionToMove = new Vector3[map.width, map.height];
107 BuildMap();
242 void BuildMap() {
243 numTowers = 0;
244 Vector3 position = Vector3.zero;
245 spawners = new List<Spawner>();
246 towers = new List<Tower>();
284 foreach (Vector3 direction in new Vector3[] {
285 Vector3.down, Vector3.left, Vector3.up, Vector3.right, }) {
286 Vector3 check = target + direction;
TrackVertex.cs (https://bitbucket.org/ddreaper/racing-game-kit.git) C# · 276 lines
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // TrackVertex.cs
4 //
5 // Microsoft XNA Community Game Platform
31 /// Position of this point
32 /// </summary>
33 public Vector3 pos;
34 /// <summary>
35 /// Right, up and dir vectors
36 /// </summary>
37 public Vector3 right, up, dir;
38 /// <summary>
39 /// Texture coordinates, u goes along with the road, v is left and right,
250 public TrackVertex(Vector3 setPos,
251 Vector3 setRight, Vector3 setUp, Vector3 setDir,
252 Vector2 setUv, float setRoadWidth)
253 {
ImpAI.cs (https://bitbucket.org/BitDemon/groupproject.git) C# · 129 lines
CutstageTrackingScript.cs (https://bitbucket.org/fredbuffet/fredbuffet.git) C# · 161 lines
MissileLauncher.cs (https://bitbucket.org/theluxx/deckdefender.git) C# · 153 lines
42 transform.LookAt(new Vector3(_target.transform.position.x, transform.position.y, _target.transform.position.z));
43 _atkTimer -= Time.deltaTime;
118 public void SpawnMissile()
119 {
120 Vector3 spawnPoint = new Vector3(_target.transform.position.x, _target.transform.position.y + 10.0f, transform.position.z);
121 _bullet.GetComponent<Missile>()._target = _target;
122 _bullet.GetComponent<Missile>()._launcher = this;
GeneticsMain.cs (https://bitbucket.org/clomax/evosim) C# · 122 lines
25 float creature_spread;
27 Vector3 max_root_scale;
28 Vector3 min_root_scale;
34 eth = Ether.getInstance();
36 max_root_scale = new Vector3();
37 max_root_scale.x = float.Parse( settings.contents["creature"]["root"]["max_root_scale"]["x"].ToString() );
38 max_root_scale.y = float.Parse( settings.contents["creature"]["root"]["max_root_scale"]["y"].ToString() );
77 /* Randomly select point on root's surface */
78 Vector3 tmp = new Vector3(0F,0F,0F);
79 // set all axes to random float between -.5 and .5
80 for (int k=0; k<3; k++) {
90 Vector3 point = tmp;
91 //Debug.Log(point);
92 Vector3 scale = new Vector3 (2F,2F,5F);
93 int recurrances = Random.Range(0,recursion_limit);
94 chromosome.addLimb(col, point, scale, recurrances);
BlindWomen_MixAttack.cs (https://bitbucket.org/Mugicer/san-zhuan.git) C# · 92 lines
32 }
33 //還需要設置 盲女 位置
34 animator.transform.position = po[Random.Range(0,4)].transform.position + new Vector3(Random.Range(5f, -5f), 0, Random.Range(5f,-5f));
35 //還需要設置 小女孩 位置
36 child.transform.position = mid.transform.position + new Vector3(Random.Range(35f,-35f),0,Random.Range(27.5f,-27.5f));
40 GameObject c = Instantiate(lamp);
41 animator.GetComponent<Blind_women>().Lamp[i]=c;
42 c.transform.position = mid.transform.position + new Vector3(Random.Range(35f, -35f), 0, Random.Range(27.5f, -27.5f));
43 }
44 }
46 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
47 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
48 animator.transform.LookAt(new Vector3(player.position.x,animator.transform.position.y, player.position.z));
49 child.transform.LookAt(new Vector3(player.position.x, animator.transform.position.y, player.position.z));
VertexChannelCollection.cs (https://bitbucket.org/refuzion/monogame.git) C# · 373 lines
142 /// Converts the channel, at the specified index, to another vector format.
143 /// </summary>
144 /// <typeparam name="TargetType">Type of the target format. Can be one of the following: Single, Vector2, Vector3, Vector4, IPackedVector</typeparam>
145 /// <param name="index">Index of the channel to be converted.</param>
146 /// <returns>New channel in the specified format.</returns>
174 /// Converts the channel, specified by name to another vector format.
175 /// </summary>
176 /// <typeparam name="TargetType">Type of the target format. Can be one of the following: Single, Vector2, Vector3, Vector4, IPackedVector</typeparam>
177 /// <param name="name">Name of the channel to be converted.</param>
178 /// <returns>New channel in the specified format.</returns>
Frustum.cs (https://bitbucket.org/FlyMan/radegast.git) C# · 232 lines
164 public class BoundingVolume
165 {
166 Vector3 Min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
167 Vector3 Max = new Vector3(float.MinValue, float.MinValue, float.MinValue);
168 float R = 0f;
170 public Vector3 ScaledMin = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
171 public Vector3 ScaledMax = new Vector3(float.MinValue, float.MinValue, float.MinValue);
176 ScaledMin = Min * scale;
177 ScaledMax = Max * scale;
178 Vector3 dist = ScaledMax - ScaledMin;
179 ScaledR = dist.Length();
180 }
221 }
223 //public void CreateBoundingVolume(Model mesh, Vector3 min, Vector3 max)
224 //{
225 // Min = min;
CatmullRomSpline.cs (https://bitbucket.org/agnavarroSyn88/assessment.git) C# · 421 lines
77 }
79 public static Vector3 ComputeBinormal(Vector3 tangent, Vector3 normal)
80 {
81 return Vector3.Cross(tangent, normal).normalized;
374 }
376 private static Vector3 FindSplinePoint(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
377 {
378 Vector3 ret = new Vector3();
399 }
401 private static Vector3 FindSplineTangent(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
402 {
403 Vector3 ret = new Vector3();
VBScreenHelper.cs (https://bitbucket.org/totallyevil/racing-game-kit.git) C# · 254 lines
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // VBScreenHelper.cs
4 //
5 // Microsoft XNA Community Game Platform
52 {
53 new VertexPositionTexture(
54 new Vector3(-1.0f, -1.0f, 0.5f),
55 new Vector2(0, 1)),
56 new VertexPositionTexture(
57 new Vector3(-1.0f, 1.0f, 0.5f),
58 new Vector2(0, 0)),
59 new VertexPositionTexture(
ItemFactory.cs (https://bitbucket.org/TheRealAtho/mango.git) C# · 179 lines
42 DbCon.ExecuteNonQuery();
44 Item Item = new Item(DbCon.SelectLastId(), Data, Data.Id, Player.Id, 0, "", 0, new Vector3D(), Flags, DisplayFlags, Untradable, ExpireTimestamp, 0, 0);
46 DbCon.Commit();
88 DbCon.ExecuteNonQuery();
90 Item Item = new Item(DbCon.SelectLastId(), Data, Data.Id, Player.Id, 0, "", 0, new Vector3D(), Flags, DisplayFlags, Untradable, ExpireTimestamp, 0, 0);
91 Items.Add(Item);
92 }
153 int Item2Id = DbCon.SelectLastId();
155 Item Item1 = new Item(Item1Id, Data, Data.Id, Player.Id, 0, "", 0, new Vector3D(), Item2Id.ToString(), "", Untradable, ExpireTimestamp, 0, 0);
156 Item Item2 = new Item(Item2Id, Data, Data.Id, Player.Id, 0, "", 0, new Vector3D(), Item1Id.ToString(), "", Untradable, ExpireTimestamp, 0, 0);
BitVector32.cs (https://bitbucket.org/luobailiang/mono.git) C# · 233 lines
1 //
2 // System.Collections.Specialized.BitVector32.cs
3 //
4 // Author:
35 namespace System.Collections.Specialized {
37 public struct BitVector32 {
38 int bits;
108 // Constructors
110 public BitVector32 (BitVector32 source)
111 {
112 bits = source.bits;
196 public override bool Equals (object o)
197 {
198 return (o is BitVector32) && bits == ((BitVector32) o).bits;
199 }
SpringTrap.cs (https://bitbucket.org/ragoston/fins-nightmare.git) C# · 148 lines
6 private Transform objectToMove;
7 // Use this for initialization
8 Vector3 currentVelocity;
9 private ImageSequencePlayer imagePlayer;
10 public enum TypeOfTrap
85 Destroy(GetComponent<Collider2D>());
86 //self collider eliminated.
87 Vector3 objectIdlePos = objectToMove.position;
88 while(Mathf.Abs(objectToMove.position.y - objectIdlePos.y) < springDistance)
89 {
90 objectToMove.position = Vector3.SmoothDamp(objectToMove.position,
91 objectToMove.position + Vector3.up * springDistance, ref currentVelocity, timeToFinish);
Skidmarks.cs (https://bitbucket.org/marvin0038/racer.git) C# · 154 lines
21 // Variables for each mark created. Needed to generate the correct mesh.
22 class MarkSection{
23 public Vector3 pos = Vector3.zero;
24 public Vector3 normal = Vector3.zero;
25 public Vector4 tangent = Vector4.zero;
26 public Vector3 posl = Vector3.zero;
27 public Vector3 posr = Vector3.zero;
47 // create the mesh later. Sets the intensity of the skidmark section b setting the alpha
48 // of the vertex color.
49 public int AddSkidMark(Vector3 pos, Vector3 normal, float intensity, int lastIndex)
50 {
51 if(intensity > 1)
64 Vector3 dir = (curr.pos - last.pos);
65 Vector3 xDir = Vector3.Cross(dir,normal).normalized;
67 curr.posl = curr.pos + xDir * markWidth * 0.5f;
PathManager.cs (https://bitbucket.org/Grimelios/starlight.git) C# · 186 lines
TestCommands~Tween.cs (https://bitbucket.org/Darcy_Rayner/commandqueue.git) C# · 778 lines
40 Vector3 vec3Offset = new Vector3(4.0f, 19.0f, 2.0f);
41 Vector3 vec3Start = new Vector3(92.0f, 0.5f, 34.0f);
42 Vector3 vec3Val = vec3Start;
43 Ref<Vector3> vec3Ref = new Ref<Vector3>(
44 () => vec3Val,
45 t => vec3Val = t
301 Vector3 vec3End = new Vector3(4.0f, 19.0f, 2.0f);
302 Vector3 vec3Start = new Vector3(92.0f, 0.5f, 34.0f);
303 Vector3 vec3Val = vec3Start;
304 Ref<Vector3> vec3Ref = new Ref<Vector3>(
305 () => vec3Val,
306 t => vec3Val = t
596 Vector3 vec3Val = vec3Start;
597 Ref<Vector3> vec3Ref = new Ref<Vector3>(
598 () => vec3Val,
599 t => vec3Val = t
ShaderEffect.cs (https://bitbucket.org/ddreaper/racing-game-kit.git) C# · 863 lines
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // ShaderEffect.cs
4 //
5 // Microsoft XNA Community Game Platform
177 /// <param name="newVector">New vector</param>
178 private static void SetValue(EffectParameter param,
179 ref Vector3 lastUsedVector, Vector3 newVector)
180 {
181 if (param != null &&
331 }
333 protected Vector3 lastUsedLightDir = Vector3.Zero;
334 /// <summary>
335 /// Set light direction
ProjectileLauncher.cs (https://bitbucket.org/jiseongkim/3did_shared.git) C# · 116 lines
44 void SpawnProjectile(long UserId)
45 {
46 Vector3 ProjectilePosition = Camera.main.transform.position + Camera.main.transform.forward * 0.85f;
47 Vector3 ProjectileDirection = Camera.main.transform.forward;
61 /// <param name="direction">Position to shoot toward</param>
62 /// <param name="radius">Size of destruction when colliding.</param>
63 void ShootProjectile(Vector3 start, Vector3 direction, long OwningUser)
64 {
65 // Need to know the index in the PlayerAvatarStore to grab for this projectile's behavior.
107 // Parse the message
108 long userID = msg.ReadInt64();
109 Vector3 remoteProjectilePosition = CustomMessages.Instance.ReadVector3(msg);
111 Vector3 remoteProjectileDirection = CustomMessages.Instance.ReadVector3(msg);
MegaModifyObject.cs (https://bitbucket.org/isereda_visco/vuforiademoiosbuild.git) C# · 518 lines
134 {
135 bbox = cachedMesh.bounds;
136 sverts = new Vector3[cachedMesh.vertexCount];
137 verts = cachedMesh.vertices;
287 bbox = newmesh.bounds;
288 sverts = new Vector3[mesh.vertexCount];
289 verts = mesh.vertices;
322 {
323 bbox = cachedMesh.bounds;
324 sverts = new Vector3[cachedMesh.vertexCount];
325 verts = cachedMesh.vertices;
GvrReticlePointerImpl.cs (https://bitbucket.org/gcgmm/mm_2017-1_not_equipe-6.git) C# · 177 lines
56 public float ReticleOuterDiameter { get; private set; }
58 private Vector3 targetPoint = Vector3.zero;
59 public override Vector3 LineEndPoint { get { return targetPoint; } }
156 }
158 private bool SetPointerTarget(Vector3 target, bool interactive) {
159 if (base.PointerTransform == null) {
160 Debug.LogWarning("Cannot operate on a null pointer transform");
162 }
163 targetPoint = target;
164 Vector3 targetLocalPosition = base.PointerTransform.InverseTransformPoint(target);
166 ReticleDistanceInMeters =
Manipulator.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 416 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="Manipulator.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
35 public static readonly DependencyProperty OffsetProperty = DependencyProperty.Register(
36 "Offset",
37 typeof(Vector3D),
38 typeof(Manipulator),
39 new FrameworkPropertyMetadata(
40 new Vector3D(0, 0, 0), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PositionChanged));
42 /// <summary>
360 /// Transformed vector (world coords).
361 /// </returns>
362 protected Vector3D ToWorld(Vector3D vector)
363 {
364 var mat = Visual3DHelper.GetTransform(this);
ButtonManager.cs (https://bitbucket.org/ozgurtaskin/mobgedomain.git) C# · 239 lines
GameStateManager.cs (https://bitbucket.org/adam19/breakout_unity.git) C# · 336 lines
DOTweenTextMeshPro.cs (https://bitbucket.org/hautecouture_matsuyama/100apps_ppg_readyset.git) C# · 239 lines
83 {
84 Transform t = target.transform;
85 Vector3 endValueV3 = new Vector3(endValue, endValue, endValue);
86 return DOTween.To(() => t.localScale, x => t.localScale = x, endValueV3, duration).SetTarget(target);
87 }
197 {
198 Transform t = target.transform;
199 Vector3 endValueV3 = new Vector3(endValue, endValue, endValue);
200 return DOTween.To(() => t.localScale, x => t.localScale = x, endValueV3, duration).SetTarget(target);
201 }
UIGeometry.cs (https://bitbucket.org/concuror/gamaton_demo.git) C# · 127 lines
24 /// </summary>
26 public BetterList<Vector3> verts = new BetterList<Vector3>();
28 /// <summary>
40 // Relative-to-panel vertices, normal, and tangent
41 BetterList<Vector3> mRtpVerts = new BetterList<Vector3>();
42 Vector3 mRtpNormal;
90 mRtpNormal = widgetToPanel.MultiplyVector(Vector3.back).normalized;
91 Vector3 tangent = widgetToPanel.MultiplyVector(Vector3.right).normalized;
92 mRtpTan = new Vector4(tangent.x, tangent.y, tangent.z, -1f);
93 }
99 /// </summary>
101 public void WriteToBuffers (BetterList<Vector3> v, BetterList<Vector2> u, BetterList<Color32> c, BetterList<Vector3> n, BetterList<Vector4> t)
102 {
103 if (mRtpVerts != null && mRtpVerts.size > 0)
Layer.cs (https://bitbucket.org/zeroeth/unitmx.git) C# · 178 lines
48 //_currentLayerID = _currentLayerID * 10;
49 float z = _currentLayerID * -10;
50 List<Vector3> vertices = new List<Vector3> ();
51 for (int i = 1; i <= _height; i++) {
52 for (int j = 1; j <= _width; j++) {
77 //_currentLayerID = _currentLayerID * 10;
78 TileSet.CollisionFormat collision = TileSet.CollisionFormat.none;
79 List<Vector3> vertices = new List<Vector3> ();
80 for (int i = 1; i <= _height; i++) {
81 for (int j = 1; j <= _width; j++) {
94 }
95 if ((collision & TileSet.CollisionFormat.bottom) != 0) {
96 vertices.AddRange (new Vector3[] {
97 new Vector3 (_tileset.width * j, _tileset.height * -i, z),
116 new Vector3 (_tileset.width * (j + 1), _tileset.height * (-i + 0), z),
117 new Vector3 (_tileset.width * (j + 1), _tileset.height * (-i + 0), z2),
118 new Vector3 (_tileset.width * (j + 1), _tileset.height * (-i + 1), z),
UIDragObject.cs (https://bitbucket.org/golivegaming/lalkamal-neelkamal.git) C# · 232 lines
UIGeometry.cs (https://bitbucket.org/adiq94/villageposition.git) C# · 135 lines
24 /// </summary>
26 public BetterList<Vector3> verts = new BetterList<Vector3>();
28 /// <summary>
44 // Relative-to-panel vertices, normal, and tangent
45 BetterList<Vector3> mRtpVerts = new BetterList<Vector3>();
46 Vector3 mRtpNormal;
94 mRtpNormal = widgetToPanel.MultiplyVector(Vector3.back).normalized;
95 Vector3 tangent = widgetToPanel.MultiplyVector(Vector3.right).normalized;
96 mRtpTan = new Vector4(tangent.x, tangent.y, tangent.z, -1f);
97 }
105 #if UNITY_3_5_4
106 public void WriteToBuffers (BetterList<Vector3> v, BetterList<Vector2> u, BetterList<Color> c, BetterList<Vector3> n, BetterList<Vector4> t)
107 #else
108 public void WriteToBuffers (BetterList<Vector3> v, BetterList<Vector2> u, BetterList<Color32> c, BetterList<Vector3> n, BetterList<Vector4> t)
MathUtils.cs (https://bitbucket.org/yamasakai/frog-fight-club.git) C# · 279 lines
19 }
21 public static Vector3 ExponentialEase(float easeSpeed, Vector3 start, Vector3 end, float dt)
22 {
23 Vector3 diff = end - start;
55 }
57 public static Vector3 ReflectIfAgainstNormal(Vector3 vec, Vector3 normal)
58 {
59 //If the move direction is going back into the wall reflect the movement away from the wall
124 lineSegPt2.y -= lineSegmentLength * 0.5f;
126 Vector3 lineSegPtDiff = lineSegPt2 - lineSegPt1;
128 //This formula will give the projected percent along the line segment.
Sprites.cs (https://bitbucket.org/copelands/csc490_final.git) C# · 181 lines
QuadTreeTileProvider.cs (https://bitbucket.org/laurentantoine/sauron_bitbucket_repository.git) C# · 144 lines
24 _cbtpOptions.camera = Camera.main;
25 }
26 _groundPlane = new Plane(Vector3.up, 0);
27 _shouldUpdate = true;
28 }
31 {
32 //Camera Debugging
33 //Vector3[] frustumCorners = new Vector3[4];
34 //_cbtpOptions.camera.CalculateFrustumCorners(new Rect(0, 0, 1, 1), _cbtpOptions.camera.transform.position.y, Camera.MonoOrStereoscopicEye.Mono, frustumCorners);
76 private Vector2dBounds getcurrentViewPortWebMerc(bool useGroundPlane = true)
77 {
78 Vector3[] hitPnt = new Vector3[4];
80 if (useGroundPlane)
120 }
122 Vector3 hitPntLL = new Vector3(minX, 0, minZ);
123 Vector3 hitPntUR = new Vector3(maxX, 0, maxZ);
EffectParameter.cs (https://bitbucket.org/refuzion/monogame.git) C# · 608 lines
248 }
250 public Vector3 GetValueVector3 ()
251 {
252 if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
255 var vecInfo = (float[])Data;
256 return new Vector3(vecInfo[0],vecInfo[1],vecInfo[2]);
257 }
259 public Vector3[] GetValueVector3Array ()
260 {
261 throw new NotImplementedException();
BasicEffect.cs (https://bitbucket.org/refuzion/monogame.git) C# · 545 lines
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // BasicEffect.cs
4 //
5 // Microsoft XNA Community Game Platform
54 Matrix worldView;
56 Vector3 diffuseColor = Vector3.One;
57 Vector3 emissiveColor = Vector3.Zero;
58 Vector3 ambientLightColor = Vector3.Zero;
60 float alpha = 1;
132 /// Gets or sets the material diffuse color (range 0 to 1).
133 /// </summary>
134 public Vector3 DiffuseColor
135 {
136 get { return diffuseColor; }
Vector4.cs (https://bitbucket.org/refuzion/monogame.git) C# · 689 lines
117 }
119 public Vector4(Vector3 value, float w)
120 {
121 this.X = value.X;
546 }
548 public static Vector4 Transform(Vector3 position, Matrix matrix)
549 {
550 Vector4 result;
567 }
569 public static void Transform(ref Vector3 position, ref Matrix matrix, out Vector4 result)
570 {
571 result = new Vector4((position.X * matrix.M11) + (position.Y * matrix.M21) + (position.Z * matrix.M31) + matrix.M41,
Vector3.cs (https://bitbucket.org/refuzion/monogame.git) C# · 736 lines
190 }
192 public static Vector3 CatmullRom(Vector3 value1, Vector3 value2, Vector3 value3, Vector3 value4, float amount)
193 {
194 return new Vector3(
198 }
200 public static void CatmullRom(ref Vector3 value1, ref Vector3 value2, ref Vector3 value3, ref Vector3 value4, float amount, out Vector3 result)
201 {
202 result = new Vector3(
326 }
328 public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
329 {
330 result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
PrimitivesConverter.cs (https://bitbucket.org/alexshtf/sketchmodeller.git) C# · 93 lines
33 }
35 public NewPrimitive NewToNew(NewPrimitive source, Type targetType, Vector3D moveVector)
36 {
37 return newConvertersRegistry[GetKey(source, targetType)].Convert(source, moveVector);
38 }
40 public void ApplyMovement(NewPrimitive source, NewPrimitive target, Vector3D moveVector)
41 {
42 newConvertersRegistry[GetKey(source, target)].ApplyMovement(source, target, moveVector);
People.cs (https://bitbucket.org/FlyMan/radegast.git) C# · 183 lines
100 private double Heading(Vector3 place)
101 {
102 Vector3 v3 = Vector3.Transform(
103 Vector3.UnitX,
123 // Rotate the vector opposite to our body rotation.
124 Vector3 faceRelative = Vector3.Transform(
125 difference,
126 Matrix4.CreateFromQuaternion(my.Movement.BodyRotation));
132 }
134 internal Vector3 SameDirection(Vector3 theirpos)
135 {
136 AgentManager my = control.instance.Client.Self;
141 // Make a 4m vector in the same direction.
142 Vector3 pointer = Vector3.Multiply(
143 Vector3.Normalize( difference ), 4.0f );
IEffectLights.cs (https://bitbucket.org/refuzion/monogame.git) C# · 56 lines
Vector4.cs (https://bitbucket.org/cjrgaming/bullet-noxna.git) C# · 686 lines
Quaternion.cs (https://bitbucket.org/cjrgaming/bullet-noxna.git) C# · 678 lines
54 public Quaternion(Vector3 vectorPart, float scalarPart)
55 {
56 this.X = vectorPart.X;
141 }
143 public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
144 {
145 double sin_a = Math.Sin(angle / 2.0);
150 public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)
151 {
152 double sin_a = Math.Sin(angle / 2.0);
Ball.cs (https://bitbucket.org/MalcolmH/assignment2networking.git) C# · 145 lines
16 void Start ()
17 {
18 velocity = Vector3.Normalize(new Vector3(speed, speed, 0f)) * speed;
19 }
20 public static Vector3 StringToVector3(string sVector)
31 // store as a Vector3
32 Vector3 result = new Vector3(
33 float.Parse(sArray[0]),
34 float.Parse(sArray[1]),
119 scoreRText.text = scoreR.ToString();
120 speed = 5f;
121 velocity = Vector3.Normalize(new Vector3(speed, 0f, 0f)) * speed;
122 transform.position = new Vector3(-6.5f, GameObject.Find("PaddleL").transform.position.y, 0f);
127 scoreLText.text = scoreL.ToString();
128 speed = 5f;
129 velocity = Vector3.Normalize(new Vector3(-speed, 0f, 0f)) * speed;
130 transform.position = new Vector3(6.5f, GameObject.Find("PaddleR").transform.position.y, 0f);
SunLight.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 151 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="SunLight.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
45 /// The altitude axis.
46 /// </summary>
47 private readonly Vector3D AltitudeAxis = new Vector3D(0, 1, 0);
49 /// <summary>
50 /// The azimuth axis.
51 /// </summary>
52 private readonly Vector3D AzimuthAxis = new Vector3D(0, 0, 1);
54 #endregion
138 var t1 = new RotateTransform3D(new AxisAngleRotation3D(this.AzimuthAxis, this.Azimuth));
139 var t2 = new RotateTransform3D(new AxisAngleRotation3D(this.AltitudeAxis, this.Altitude));
140 var dir = t1.Transform(t2.Transform(new Vector3D(1, 0, 0)));
142 var i = (byte)(255 * this.Brightness);
OlsenSphere.cs (https://bitbucket.org/VirtualReality/async-sim-testing-depracated.git) C# · 242 lines
Teapot.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 164 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="Teapot.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
29 public static readonly DependencyProperty SpoutDirectionProperty = DependencyProperty.Register(
30 "SpoutDirection",
31 typeof(Vector3D),
32 typeof(Teapot),
33 new UIPropertyMetadata(new Vector3D(1, 0, 0), TransformChanged));
38 public static readonly DependencyProperty UpDirectionProperty = DependencyProperty.Register(
39 "UpDirection",
40 typeof(Vector3D),
41 typeof(Teapot),
42 new UIPropertyMetadata(new Vector3D(0, 0, 1), TransformChanged));
137 Vector3D right = this.SpoutDirection;
138 Vector3D back = Vector3D.CrossProduct(this.UpDirection, right);
139 Vector3D up = this.UpDirection;
BlobMove.cs (https://bitbucket.org/Danvil/ld26_minimal.git) C# · 182 lines
51 }
53 Vector3 computePlayerFollow() {
54 const float cMinRadius = 1.0f;
55 Vector3 d = Globals.Player.transform.position - transform.position;
102 Vector3 computeAvoidOther() {
103 Vector3 force = Vector3.zero;
104 foreach(BlobMove x in Globals.BlobManager.GetMoveBehaviours()) { // TODO reduce range
105 Vector3 delta = x.transform.position - transform.position;
113 Vector3 computeAvoidBombs() {
114 Vector3 force = Vector3.zero;
115 foreach(Bomb x in Globals.BombManager.GetBombs()) { // TODO reduce range
116 Vector3 delta = x.transform.position - transform.position;
124 Vector3 computeAvoidLevel() {
125 Vector3 force = Vector3.zero;
126 Vector3 pos = this.transform.position.WithChangedZ(0.0f);
Viewport.cs (https://bitbucket.org/greenboxdevelopment/greenbox3d.git) C# · 176 lines
124 #region Public Methods and Operators
126 public Vector3 Project(Vector3 source, Matrix4 projection, Matrix4 view, Matrix4 world)
127 {
128 Matrix4 matrix = Matrix4.Mult(Matrix4.Mult(world, view), projection);
129 Vector3 vector = Vector3.Transform(source, matrix);
130 float a = (((source.X * matrix.M14) + (source.Y * matrix.M24)) + (source.Z * matrix.M34)) + matrix.M44;
145 }
147 public Vector3 Unproject(Vector3 source, Matrix4 projection, Matrix4 view, Matrix4 world)
148 {
149 Matrix4 matrix = Matrix4.Invert(Matrix4.Mult(Matrix4.Mult(world, view), projection));
Anchor.cs (https://bitbucket.org/jonathondhartunisa/firstpersonsquared.git) C# · 238 lines
179 drawWireSphereGizmo(Vector3.zero, radius);
181 drawSphereCirclesGizmo(5, Vector3.zero, radius, Vector3.forward);
183 Gizmos.matrix = origMatrix;
184 }
186 private static Vector3[] worldDirs = new Vector3[] { Vector3.right, Vector3.up, Vector3.forward };
188 private void drawWireSphereGizmo(Vector3 pos, float radius) {
193 }
195 private void drawSphereCirclesGizmo(int numCircles, Vector3 pos, float radius, Vector3 poleDir) {
196 float dTheta = 180F / numCircles;
197 float halfTheta = dTheta / 2F;
PlayerCamera.cs (https://bitbucket.org/katas94/frustum-tessitura.git) C# · 157 lines
64 {
65 // calculamos la rotacion que aplicaremos a la camara segun el movimiento del aton
66 Vector3 deltaRotation = new Vector3(-Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X")) * sensitivity;
68 if (!catched)
69 {
70 deltaRotation = Vector3.zero;
71 }
116 private IEnumerator C_FollowTarget ()
117 {
118 Vector3 currentVelocity = Vector3.zero;
120 Vector3 lookAtVelocity = Vector3.zero;
121 Vector3 upVelocity = Vector3.zero;
122 Vector3 currentForward = transform.forward;
EquipmentForgeContent.cs (https://bitbucket.org/MyongJu/decompile.git) C# · 139 lines
113 if (!((UnityEngine.Object) this.scrollView != (UnityEngine.Object) null) || !((UnityEngine.Object) this.scrollView.panel != (UnityEngine.Object) null))
114 return;
115 Vector3[] worldCorners = this.scrollView.panel.worldCorners;
116 Vector3 panelBottom = (worldCorners[1] + worldCorners[2]) * 0.5f;
118 }
120 private void CenterOn(Transform target, Vector3 panelBottom)
121 {
122 if (!((UnityEngine.Object) target != (UnityEngine.Object) null) || !((UnityEngine.Object) this.scrollView != (UnityEngine.Object) null) || (!((UnityEngine.Object) this.scrollView.panel != (UnityEngine.Object) null) || !(this.scrollView.currentMomentum == Vector3.zero)))
123 return;
124 Transform cachedTransform = this.scrollView.panel.cachedTransform;
125 Vector3 vector3 = cachedTransform.InverseTransformPoint(target.position) - cachedTransform.InverseTransformPoint(panelBottom);
126 if (!this.scrollView.canMoveHorizontally)
127 vector3.x = 0.0f;
128 if (!this.scrollView.canMoveVertically)
129 vector3.y = 0.0f;
130 vector3.z = 0.0f;
ConstructionRequirementBtn.cs (https://bitbucket.org/MyongJu/decompile.git) C# · 166 lines
39 GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(AssetManager.Instance.HandyLoad(iconName, (System.Type) null) as GameObject);
40 gameObject.transform.parent = this.mIcon.transform;
41 gameObject.transform.localPosition = Vector3.zero;
42 int width = gameObject.GetComponent<UIWidget>().width;
43 int height = gameObject.GetComponent<UIWidget>().height;
44 float num = width < height ? 150f / (float) height : 150f / (float) width;
45 gameObject.transform.localScale = new Vector3(num, num, 1f);
46 }
47 else
89 GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(AssetManager.Instance.HandyLoad(iconName, (System.Type) null) as GameObject);
90 gameObject.transform.parent = this.mIcon.transform;
91 gameObject.transform.localPosition = Vector3.zero;
92 int width = gameObject.GetComponent<UIWidget>().width;
93 int height = gameObject.GetComponent<UIWidget>().height;
FRadialWipeSprite.cs (https://bitbucket.org/ironpencil/tankfight.git) C# · 338 lines
231 //now do the actual population
233 Vector3[] vertices = _renderLayer.vertices;
234 Vector2[] uvs = _renderLayer.uvs;
235 Color[] colors = _renderLayer.colors;
268 //set the mesh
269 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0], _meshVertices[6],0);
270 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0 + 1], _meshVertices[0],0);
271 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0 + 2], _meshVertices[1],0);
273 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0 + 3], _meshVertices[6],0);
274 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0 + 4], _meshVertices[1],0);
275 _concatenatedMatrix.ApplyVector3FromLocalVector2(ref vertices[vertexIndex0 + 5], _meshVertices[2],0);
CFX_Demo_New.cs (https://bitbucket.org/hautecouture_matsuyama/100apps_ppg_readyset.git) C# · 209 lines
21 private int exampleIndex;
22 private bool slowMo;
23 private Vector3 defaultCamPosition;
24 private Quaternion defaultCamRotation;
76 if(scroll != 0f)
77 {
78 Camera.main.transform.Translate(Vector3.forward * (scroll < 0f ? -1f : 1f), Space.Self);
79 }
131 {
132 GameObject particles = (GameObject)Instantiate(ParticleExamples[exampleIndex]);
133 particles.transform.position = new Vector3(0,particles.transform.position.y,0);
134 #if UNITY_3_5
135 particles.SetActiveRecursively(true);
Triangle3D.cs (https://bitbucket.org/Jackie0100/abovequantum.git) C# · 349 lines
34 }
36 public Triangle3D(Vector3 point0, Vector3 point1, Vector3 point2)
37 {
38 _points = new Vector3[3];
92 // with the triangle esges.
93 // Test a00 = <1, 0, 0> X e0 = <0, -e0.z, e0.y>
94 Vector3 axis = new Vector3(0.0f, -e0.z, e0.y);
95 float v0Prj = Vector3.Dot(v0, axis);
330 Vector3 edge1 = Point2 - Point0;
331 Vector3 normal = Vector3.Cross(edge0, edge1);
333 if(normal.magnitude < 1e-5f)
334 {
335 _area = 0.0f;
336 _plane = new Plane(Vector3.zero, Vector3.zero);
337 }
338 else
BoxCollisionShapeTests.cs (https://bitbucket.org/spanky/valor3d) C# · 210 lines
24 BoxCollisionShape box = new BoxCollisionShape(new BoxCollisionShape.RetrieveLocalBoundsHandler(GetUnitCube));
26 IntersectionResult result = box.Intersect(null, new Mogre.Vector3(1.0f, 0.0f, 0.0f), new Mogre.Vector3(-1.0f, 0.0f, 0.0f), false);
27 Assert.IsTrue(result.IsValid, "The intersection result was not valid");
28 Assert.AreEqual(0.5f, result.Distance, "The intersection location was not at the correct location");
35 BoxCollisionShape box = new BoxCollisionShape(new BoxCollisionShape.RetrieveLocalBoundsHandler(GetUnitCube));
37 IntersectionResult result = box.Intersect(null, new Mogre.Vector3(0.0f, 1.0f, 0.0f), new Mogre.Vector3(0.0f, -1.0f, 0.0f), false);
38 Assert.IsTrue(result.IsValid, "The intersection result was not valid");
39 Assert.AreEqual(0.5f, result.Distance, "The intersection location was not at the correct location");
46 BoxCollisionShape box = new BoxCollisionShape(new BoxCollisionShape.RetrieveLocalBoundsHandler(GetUnitCube));
48 IntersectionResult result = box.Intersect(null, new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Mogre.Vector3(0.0f, 0.0f, -1.0f), false);
49 Assert.IsTrue(result.IsValid, "The intersection result was not valid");
50 Assert.AreEqual(0.5f, result.Distance, "The intersection location was not at the correct location");
Actor.cs (https://bitbucket.org/stefan-g-i/likegta.sgi.git) C# · 335 lines
36 /// Top position when the actor is standing.
37 /// </summary>
38 public Vector3 RelativeStandingTopPosition
39 {
40 get
41 {
42 if (_hasStandingHeight)
43 return Vector3.up * _standingHeight;
44 else
45 return Vector3.up * _height;
50 /// Current top position.
51 /// </summary>
52 public Vector3 RelativeTopPosition
53 {
54 get { return Vector3.up * _height; }
Player.cs (https://bitbucket.org/Danvil/ld26_minimal.git) C# · 193 lines
56 int i = inventory.Count - 1;
57 float phi = ((float)i) * 40.0f;
58 go.transform.localPosition = new Vector3(s*Mathf.Cos(phi), s*Mathf.Sin(phi), -0.4f);
59 }
74 {
75 // move with keyboard
76 Vector3 movedir = Vector3.zero;
77 if(Input.GetKey(KeyCode.A)) {
78 movedir += new Vector3(-1,0,0);
82 }
83 if(Input.GetKey(KeyCode.W)) {
84 movedir += new Vector3(0,+1,0);
85 }
86 if(Input.GetKey(KeyCode.S)) {
121 Vector3 target = ray.GetPoint(- ray.origin.z / ray.direction.z);
122 Vector3 start = this.transform.position + new Vector3(0,0,-0.5f*this.transform.localScale.x -.3f);
123 bool usemega = fire2 && Globals.NumMegaBombs > 0;
124 Globals.BombManager.ThrowBomb(start, target, true, usemega);
vLookTarget.cs (https://bitbucket.org/zornco/mech-runners.git) C# · 254 lines
8 public Transform lookPointTarget;
9 [Header("Area to check if is visible")]
10 public Vector3 centerArea = Vector3.zero;
11 public Vector3 sizeArea = Vector3.one;
60 var centerY = transform.lossyScale.y * centerArea.y;
61 var centerZ = transform.lossyScale.z * centerArea.z;
62 Matrix4x4 rotationMatrix = Matrix4x4.TRS(transform.position + new Vector3(centerX, centerY, centerZ), transform.rotation, new Vector3(sizeX, sizeY, sizeZ) * 2f);
63 Gizmos.matrix = rotationMatrix;
64 Gizmos.color = new Color(0, 1, 0, 0.2f);
65 Gizmos.DrawCube(Vector3.zero, Vector3.one);
66 Gizmos.color = new Color(0, 1, 0, 1f);
67 Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
230 }
232 static bool CastPoint(Vector3 from, Vector3 point, Transform lookTarget, bool debug = false)
233 {
234 RaycastHit hit;
DefferedScene.cs (https://bitbucket.org/shishov/shengine.git) C# · 116 lines
42 camera.AddComponent<Transform>();
43 camera.AddComponent(new Camera());
44 camera.AddScript(new FreeCamera(new Vector3(10, 10, 10), Vector3.Zero));
45 _world.AddEntity(camera);
49 var light = new Entity(_world);
50 light.AddComponent(new Transform(new Vector3(-8, 10, 0)));
51 light.AddComponent(new PointLight(graphics, 500, Color.Orange.ToVector4(), 0.5f, true, 256));
52 light.AddComponent(new Rotatable(0.004f));
55 var light1 = new Entity(_world);
56 light1.AddComponent(new Transform(new Vector3(-20, 100, 0)));
57 light1.AddComponent(new PointLight(graphics, 100, Color.Blue.ToVector4(), 1f, true, 256));
58 light1.AddComponent(new Rotatable(0.008f));
PlannerGizmoAdaptive-gizmos.cs (https://bitbucket.org/kainino/constraint-aware-navigation.git) C# · 248 lines
55 void OnDrawGizmos()
56 {
57 var cubesize = new UnityEngine.Vector3(0.5f, 0.5f, 0.5f);
58 if (Planner != null) {
59 DrawVisited();
147 }
149 void DrawInvalid(UnityEngine.Vector3 cubesize)
150 {
151 if (!ShowInvalid) {
162 }
164 void DrawOpen(UnityEngine.Vector3 cubesize)
165 {
166 var open = Planner.Open;
Plane3D.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 163 lines
48 /// The n.
49 /// </param>
50 public Plane3D(Point3D p0, Vector3D n)
51 {
52 this.Position = p0;
62 /// </summary>
63 /// <value>The normal.</value>
64 public Vector3D Normal
65 {
66 get
132 // {
133 // Position = new Point3D(x, 0, Height / 2);
134 // Normal = new Vector3D(dir, 0, 0);
135 // Up = new Vector3D(0, 0, 1);
153 // {
154 // var pts = new Point3D[4];
155 // Vector3D right = Vector3D.CrossProduct(Normal, Up);
156 // pts[0] = Position + (-right * 0.5 * Width - Up * 0.5 * Height);
157 // pts[1] = Position + (right * 0.5 * Width - Up * 0.5 * Height);
Enemie1.cs (https://bitbucket.org/catalina1411/the-dot-hunt.git) C# · 169 lines
81 if (Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, groundDistance))
82 {
83 Debug.DrawLine(transform.position + (Vector3.up * 0.1f), transform.position + (Vector3.up * 0.1f) + (Vector3.down * groundDistance), Color.blue);
84 grounded = true;
87 else
88 {
89 Debug.DrawLine(transform.position + (Vector3.up * 0.1f), transform.position + (Vector3.up * 0.1f) + (Vector3.down * groundDistance), Color.red);
90 grounded = false;
91 attaking = false;
130 if(agent.enabled == true)
131 {
132 if (Vector3.Distance(transform.position,tarect.position) < (agent.stoppingDistance * 1.1f) && !attaking)
133 {
134 anim.SetLayerWeight(1, 0);
PacketWriter.cs (https://bitbucket.org/refuzion/monogame.git) C# · 176 lines
playerHitScript.cs (https://bitbucket.org/Feriluce/puzzlephysics.git) C# · 155 lines
16 CharacterController controller;
17 public float mass = 3.0f; // define the character mass
18 Vector3 impact = Vector3.zero;
19 PlayerAnimator playerAnimator;
20 public int meleeDamageTakenFromEnemies = 50;
44 }
45 // impact energy goes by over time:
46 impact = Vector3.Lerp(impact, Vector3.zero, 10*Time.deltaTime);
48 if (Input.GetKeyDown("escape")){
62 if(contact.otherCollider.CompareTag("teleportProjectile") && contact.otherCollider.gameObject.layer != 12){
63 if(plane == "front" && !platcontrol.capsuleCheck(10)){
64 transform.Translate(Vector3.forward*platDist, Space.World);
65 platcontrol.planeOfExistence = plane = "back";
66 } else if(!platcontrol.capsuleCheck(-10)){
Entity.cs (https://bitbucket.org/KuroKaze/ginga.git) C# · 186 lines
81 scale += times;
83 Matrix shiftToOriginM = Matrix.CreateTranslation(new Vector3(-origin, 0.0f));
84 Matrix scaleM = Matrix.CreateScale(scale);
85 Matrix rotateM = Matrix.CreateRotationZ(angle);
86 Matrix shiftM = Matrix.CreateTranslation(new Vector3(position, 0.0f));
87 transformM = shiftToOriginM * scaleM * rotateM * shiftM;
96 scale += times;
98 Matrix shiftToOriginM = Matrix.CreateTranslation(new Vector3(-origin, 0.0f));
99 Matrix scaleM = Matrix.CreateScale(scale);
100 Matrix rotateM = Matrix.CreateRotationZ(angle);
DungeonGameUpdate.cs (https://bitbucket.org/munhra/bossgame.git) C# · 142 lines
34 if (dungeonGameManager.gameState == DungeonGameManager.GameState.GAME_MONSTER_UP) {
35 dungeonGameManager.performGameResumeAfterMonsterUp ();
36 playGameButton.transform.position = new Vector3 (-10.0f, playGameButton.transform.position.y, 0);
37 }
38 }
105 clone.layer = 11;
106 clone.transform.parent = this.transform;
107 clone.transform.position = new Vector3 (0.83f, 19.6f, 0.0f);
108 clone.transform.localScale = new Vector3 (2.5f, 2.5f, 0.0f);
134 clone.layer = 11;
135 clone.transform.parent = this.transform;
136 clone.transform.position = new Vector3 (multiplierSelect [j], 24.70f, 0.0f);
137 clone.GetComponent<SpriteRenderer> ().sortingLayerName = "GameOverCardsLayer";
138 clone.name = "mockGameOverCard_" + j;
VertexDeclaration.cs (https://bitbucket.org/alisci01/monoxna) C# · 124 lines
enemy.cs (https://bitbucket.org/ericsanchezverges/spacebrawl.git) C# · 144 lines
14 public GameObject enemyBulletPrefab;
15 float cooldownAbility = 0.0f;
16 private Vector3 posPlayer;
17 public GameObject enemyPrefab;
18 public float distance;
30 //enemyDivide
31 public GameObject dividePrefab;
32 Vector3 randpos1;
33 Vector3 randpos2;
51 //enemy movement
52 void MoveEnemy(){
53 distance = Vector3.Distance(transform.position,posPlayer);
54 if(distance > distanceByType){
55 transform.position = Vector3.MoveTowards(transform.position, posPlayer, speed*Time.deltaTime);
62 if(distance < 10){
63 if(cooldownAbility <= 0){
64 enemyBullet enemyBullet = (Instantiate (enemyBulletPrefab, new Vector3 (transform.position.x, transform.position.y, transform.position.z),transform.rotation) as GameObject).GetComponent<enemyBullet>();
65 cooldownAbility = 2.0f;
66 }
ARRemoteEditorInterface.cs (https://bitbucket.org/cerebralfix/experimental-arinterface.git) C# · 266 lines
45 Texture2D m_RemoteScreenUVTexture;
47 List<Vector3> m_PointCloud;
48 private Matrix4x4 m_DisplayTransform;
129 var pointCloud = message.data.Deserialize<SerializablePointCloud>();
130 if (m_PointCloud == null)
131 m_PointCloud = new List<Vector3>();
133 m_PointCloud.Clear();
225 if (pointCloud.points == null)
226 pointCloud.points = new List<Vector3>();
228 pointCloud.points.Clear();
SSAOEffect.cs (https://bitbucket.org/astrism/sisyphus.git) C# · 193 lines
106 float y = Mathf.Tan (fovY * Mathf.Deg2Rad * 0.5f) * far;
107 float x = y * camera.aspect;
108 m_SSAOMaterial.SetVector ("_FarCorner", new Vector3(x,y,far));
109 int noiseWidth, noiseHeight;
110 if (m_RandomTexture) {
114 noiseWidth = 1; noiseHeight = 1;
115 }
116 m_SSAOMaterial.SetVector ("_NoiseScale", new Vector3 ((float)rtAO.width / noiseWidth, (float)rtAO.height / noiseHeight, 0.0f));
117 m_SSAOMaterial.SetVector ("_Params", new Vector4(
118 m_Radius,
156 {
157 Random.seed = 1337;
158 Vector3[] samples = new Vector3[count];
159 // initial samples
160 for (int i = 0; i < count; ++i)
166 Vector3 vec = samples[i];
167 Vector3 res = Vector3.zero;
168 // minimize with other samples
169 for (int j = 0; j < count; ++j) {
OutScreenTracker.cs (https://bitbucket.org/ozgurtaskin/mobgedomain.git) C# · 210 lines
56 {
58 //Debug.Log((Vector3)new Vector2(4, 6));
59 tr = transform;
60 layer = new GameObject().AddComponent<Layer>();
73 if (target)
74 {
75 Vector3 v = layer.tr.position;
76 Vector2 v2 = v;
77 camRect = new Rect(v.x + screenOffset.x, v.y + screenOffset.y,
82 var center = v2 + layer.size * 0.5f;
83 Vector3 tp3 = target.position;
84 Vector2 tpos2 = tp3;
85 Vector2 tp2 = tpos2;
FileHelper.cs (https://bitbucket.org/ddreaper/racing-game-kit.git) C# · 259 lines
1 #region File Description
2 //-----------------------------------------------------------------------------
3 // FileHelper.cs
4 //
5 // Microsoft XNA Community Game Platform
134 #region Write Helpers
135 /// <summary>
136 /// Write vector3 to stream
137 /// </summary>
138 /// <param name="writer">Writer</param>
139 /// <param name="vec">Vector3</param>
140 public static void WriteVector3(BinaryWriter writer, Vector3 vec)
141 {
142 if (writer == null)
200 /// <returns>Vector3</returns>
201 public static Vector3 ReadVector3(BinaryReader reader)
202 {
203 if (reader == null)
ClipPolygon.cs (https://bitbucket.org/cjrgaming/bullet-noxna.git) C# · 187 lines
32 public static float DistancePointPlane(ref Vector4 plane, ref Vector3 point)
33 {
34 return point.Dot(new Vector3(plane.X, plane.Y, plane.Z)) - plane.W;
35 }
37 /*! Vector blending
38 Takes two vectors a, b, blends them together*/
39 public static void VecBlend(ref Vector3 vr, ref Vector3 va, ref Vector3 vb, float blend_factor)
40 {
41 vr = (1 - blend_factor) * va + blend_factor * vb;
76 public static int PlaneClipPolygon(
77 ref Vector4 plane,
78 Vector3[] polygon_points,
79 int polygon_point_count,
80 Vector3[] clipped)
Eating.cs (https://bitbucket.org/kyle-romano/piyo-world.git) C# · 147 lines
59 {
60 piyoEating = true;
61 heldFood.transform.localScale = new Vector3(heldFood.transform.localScale.x - amountToReduceSizeBy, heldFood.transform.localScale.y - amountToReduceSizeBy, 1);
63 burstParticles.Play();
133 if (heldFood != null && burstParticles != null)
134 {
135 heldFood.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
136 //constantParticles.Stop();
137 burstParticles.Stop();
ImageEffects.cs (https://bitbucket.org/marvin0038/racer.git) C# · 181 lines
Matrix3.cs (https://bitbucket.org/ideasstorm/physixlab.git) C# · 393 lines
173 ///@param vector The vector to transform.
174 ///</summary>
175 public static Vector3 operator *(Matrix3 m, Vector3 vector)
176 {
177 return new Vector3(
187 ///@param vector The vector to transform.
188 ///</summary>
189 public Vector3 transform(Vector3 vector)
190 {
191 return (this) * vector;
197 ///@param vector The vector to transform.
198 ///</summary>
199 public Vector3 transformTranspose(Vector3 vector)
200 {
201 return new Vector3(
NGUITransformInspector.cs (https://bitbucket.org/Werring/unity-indusim.git) C# · 147 lines
29 {
30 NGUIEditorTools.RegisterUndo("Reset Position", trans);
31 trans.localPosition = Vector3.zero;
32 }
33 pos = DrawVector3(trans.localPosition);
95 /// </summary>
97 static Vector3 DrawVector3 (Vector3 value)
98 {
99 GUILayoutOption opt = GUILayout.MinWidth(30f);
138 /// </summary>
140 static Vector3 Validate (Vector3 vector)
141 {
142 vector.x = float.IsNaN(vector.x) ? 0f : vector.x;
CharacterMotor.cs (https://bitbucket.org/bbuck/finalproject_csc490.git) C# · 163 lines
23 [HideInInspector]
24 public Vector3 targetVelocity = Vector3.zero;
26 [HideInInspector]
56 private bool jumpQueued = false;
57 private Vector3 lastContactNormal;
59 void FixedUpdate()
93 foreach (ContactPoint point in collision.contacts)
94 {
95 totalDot += Vector3.Dot(point.normal, Vector3.up);
96 }
Accelerometer.cs (https://bitbucket.org/refuzion/monogame.git) C# · 78 lines
51 private static AccelerometerState _state;
52 private static AccelerometerCapabilities _capabilities = new AccelerometerCapabilities();
53 private static Vector3 _accelerometerVector = new Vector3(0, 0, 0);
55 public static void SetupAccelerometer()
72 {
73 var motionData = Motion.GetData(0);
74 _accelerometerVector = new Vector3(motionData.Acceleration.X, motionData.Acceleration.Y, motionData.Acceleration.Z);
75 _state.Acceleration = _accelerometerVector;
76 }
CameraViewVolume.cs (https://bitbucket.org/Jackie0100/abovequantum.git) C# · 161 lines
12 /// using members of the 'CameraViewVolumePoint' as indices.
13 /// </summary>
14 private Vector3[] _worldSpaceVolumePoints;
16 private Box _worldSpaceAABB;
37 #region Public Properties
38 public Vector3[] WorldSpaceVolumePoints { get { return _worldSpaceVolumePoints.Clone() as Vector3[]; } }
39 public Ray3D[] WorldSpaceVolumeEdgeRays { get { return _worldSpaceVolumeEdgeRays.Clone() as Ray3D[]; } }
40 public Vector3 TopLeftPointOnNearPlane { get { return _worldSpaceVolumePoints[(int)CameraViewVolumePoint.TopLeftOnNearPlane]; } }
41 public Vector3 TopRightPointOnNearPlane { get { return _worldSpaceVolumePoints[(int)CameraViewVolumePoint.TopRightOnNearPlane]; } }
42 public Vector3 BottomRightPointOnNearPlane { get { return _worldSpaceVolumePoints[(int)CameraViewVolumePoint.BottomRightOnNearPlane]; } }
43 public Vector3 BottomLeftPointOnNearPlane { get { return _worldSpaceVolumePoints[(int)CameraViewVolumePoint.BottomLeftOnNearPlane]; } }
44 public Vector3 TopLeftPointOnFarPlane { get { return _worldSpaceVolumePoints[(int)CameraViewVolumePoint.TopLeftOnFarPlane]; } }
PopupController.cs (https://bitbucket.org/norris_abu/wanttodoodle.git) C# · 114 lines
57 pc.HidePopup();
59 AudioManager.Instance.play_sfx("Audio/SFX/Click1", Vector3.zero);
60 });
67 pc.HidePopup();
68 AudioManager.Instance.play_sfx("Audio/SFX/Click1", Vector3.zero);
69 });
70 }
93 rectPopupPanel.DOScale(1, showTime);
95 AudioManager.Instance.play_sfx("Audio/SFX/Popup", Vector3.zero);
96 }).SetUpdate(true);
97 }
AlphaTestEffectReader.cs (https://bitbucket.org/refuzion/monogame.git) C# · 60 lines
NewConeViewModel.cs (https://bitbucket.org/alexshtf/sketchmodeller.git) C# · 240 lines
203 }
205 protected override void PerformDrag(Vector dragVector2d, Vector3D vector3D, Vector3D axisDragVector, Point3D? currDragPosition)
206 {
207 if (Keyboard.Modifiers == ModifierKeys.None)
219 {
220 axis.Normalize();
221 var radiusDelta = 0.5 * Vector3D.DotProduct(axis, vector3D);
222 if (viewModel.DragStartProximity == DragStartProximities.Top)
223 viewModel.TopRadius = Math.Max(NewConeViewModel.MIN_DIAMETER, viewModel.TopRadius + radiusDelta);
229 {
230 var axis = viewModel.Axis.Normalized();
231 var lengthDelta = Vector3D.DotProduct(axis, vector3D) * 2;
232 viewModel.Length = Math.Max(NewCylinderViewModel.MIN_LENGTH, viewModel.Length + lengthDelta);
233 }
NewSphereViewModel.cs (https://bitbucket.org/alexshtf/sketchmodeller.git) C# · 140 lines
101 }
103 public override Vector3D ApproximateAxis
104 {
105 get { return new Vector3D(0, 0, 0); }
118 }
120 protected override void PerformDrag(Vector dragVector2d, Vector3D vector3D, Vector3D axisDragVector, Point3D? currDragPosition)
121 {
122 if (Keyboard.Modifiers == ModifierKeys.None)
128 var fromCenter = currDragPosition.Value - viewModel.Center;
129 fromCenter.Normalize();
130 var radiusDelta = Vector3D.DotProduct(fromCenter, vector3D);
131 viewModel.Radius = Math.Max(viewModel.Radius + radiusDelta, NewSphereViewModel.MIN_RADIUS);
132 }
ClippedLegsFilter.cs (https://bitbucket.org/gcgmm/mm_2018-1_not_equipe-7.git) C# · 235 lines
1 //------------------------------------------------------------------------------
2 // <copyright file="SkeletonJointsFilterClippedLegs.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
24 {
25 // The blend weights when all leg joints are tracked.
26 private readonly Vector3 allTracked;
28 // The blend weights when the foot is inferred or not tracked.
29 private readonly Vector3 footInferred;
31 // The blend weights when ankle and below are inferred or not tracked.
32 private readonly Vector3 ankleInferred;
34 // The blend weights when knee and below are inferred or not tracked.
GvrMathHelpers.cs (https://bitbucket.org/nostalgicbear/hazardperception.git) C# · 107 lines
22 private static Vector2 sphericalCoordinatesResult;
24 public static Vector3 GetIntersectionPosition(Camera cam, RaycastResult raycastResult) {
25 // Check for camera
26 if (cam == null) {
27 return Vector3.zero;
28 }
30 float intersectionDistance = raycastResult.distance + cam.nearClipPlane;
31 Vector3 intersectionPosition = cam.transform.position + cam.transform.forward * intersectionDistance;
32 return intersectionPosition;
33 }
GFGridLightsExampleExtensions.cs (https://bitbucket.org/henchmen/hexagon.git) C# · 60 lines
20 public static class GFGridLightsExampleExtensions{
22 public static bool IsAdjacent(this GFGrid theGrid, Vector3 position, Vector3 reference){
23 //convert to Grid Space first
24 Vector3 gridPosition = theGrid.WorldToGrid(position);//the light we want to test
35 }
37 private static bool RectIsAdjacent(GFRectGrid theGrid, Vector3 position, Vector3 reference){
38 bool isAdjacent = Mathf.Abs(position.x-reference.x) <= 1.25f && Mathf.Abs(position.y-reference.y) <= 1.25f;
39 bool isDiagonal = 0.25f <= Mathf.Abs(position.x-reference.x) && 0.25f <= Mathf.Abs(position.y-reference.y) && isAdjacent;
41 }
43 private static bool HexIsAdjacent(GFHexGrid theGrid, Vector3 position, Vector3 reference){
44 bool isNeighbour = false;
45 if(Mathf.Abs(reference.y - position.y) < 1.1f && Mathf.Abs(reference.x - position.x) < 0.1f){//straight above or below
PlayerController.cs (https://bitbucket.org/ArtyomGod/gamedev-escape.git) C# · 263 lines
19 private Rigidbody2D rigidBody;
20 bool Grounded;
21 private Vector3 _origPos;
22 private Side FaceTo = Side.Right;
23 Animator AnimCharacter;
27 public bool HasSuperGun = false;
28 public bool ReadyToBoss = false;
29 private Vector3 BagOriginPos;
30 private Quaternion BagOriginRotate;
31 public bool IsAndroidControll = true;
166 gameObject.transform.Find("Weapon").GetComponent<Weapon>().SideToShoot = FaceTo;
167 transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
168 }
PositionPathTweenProperty.cs (https://bitbucket.org/yamasakai/frog-fight-club.git) C# · 132 lines
16 private Transform _target;
17 private Vector3 _startValue;
19 private GoSpline _path;
112 _target.rotation = _smoothedRotation.smoothValue;
113 //var lookAtNode = ( _ownerTween.isReversed || _ownerTween.isLoopoingBackOnPingPong ) ? _path.getPreviousNode() : _path.getNextNode();
114 //_target.LookAt( lookAtNode, Vector3.up );
115 break;
116 }
117 case GoLookAtType.TargetTransform:
118 {
119 _target.LookAt( _lookTarget, Vector3.up );
120 break;
121 }
InfiniteWorld.cs (https://bitbucket.org/Tsarpf/yacmbcp) C# · 380 lines
17 (int)WorldGameObject.worldChunkSize.z);
19 public static Vector3 playerPosLast;
20 public static Vector3 playerPosNew;
28 //public static GUIText guiText2;
30 static public Vector3 getPlayerChunkPos()
31 {
32 Vector3 playerPos = player.transform.position;
42 //int3 offset = ChunkRowUtils.ChunkArrayOffset;
44 return new Vector3(x, y, z);
45 }
51 int z = Mathf.CeilToInt(player.transform.position.z) - 1;
53 Vector3 blockCoords = new Vector3();
54 blockCoords.x = x % chunkSize.x;
55 blockCoords.y = y % chunkSize.y;
GamePadInputSource.cs (https://bitbucket.org/kmsuzanna/extensiusmanagerdashboard.git) C# · 158 lines
Polygon3D.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 168 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="Polygon3D.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
91 var right = Vector3D.CrossProduct(
92 up, Math.Abs(up.X) > Math.Abs(up.Z) ? new Vector3D(0, 0, 1) : new Vector3D(1, 0, 0));
93 var backward = Vector3D.CrossProduct(right, up);
116 /// The normal.
117 /// </returns>
118 public Vector3D GetNormal()
119 {
120 if (this.Points.Count < 3)
123 }
125 Vector3D v1 = this.Points[1] - this.Points[0];
126 for (int i = 2; i < this.Points.Count; i++)
127 {
WeatherSphere.cs (https://bitbucket.org/VirtualReality/async-sim-testing-depracated.git) C# · 215 lines
DragThroughScript.cs (https://bitbucket.org/kKapalka/obscurity-game.git) C# · 417 lines
219 public override void HighlightSelection (GameObject go)
220 {
221 List<Vector3> positions = new List<Vector3> ();
222 int posX = go.GetComponent<Shape> ().Column;
223 int posY = go.GetComponent<Shape> ().Row;
247 int end = go2.GetComponent<Shape> ().Row;
249 Vector3[] positions = new Vector3[Constants.Rows];
251 //z dolu do gory
331 int end = go2.GetComponent<Shape> ().Column;
333 Vector3[] positions = new Vector3[Constants.Columns];
335 //z lewo na prawo
PlayerCreatureBase.cs (https://bitbucket.org/arcanosteam/arcanos.git) C# · 67 lines
23 }
25 protected PlayerCreatureBase(ulong guid, CreatureTemplateBase template, CharacterBase character, Vector3 pos, Rotation rot) : base(guid, template, pos, rot)
26 {
27 Type = ObjectType.PlayerCreature;
29 }
31 public MovementValidity IsMovementValid(Vector3 source, Vector3 destination, bool clientside)
32 {
33 if (HasFlag(ObjectFlags.Stunned))
36 float speed = GetMovementSpeed();
37 if (Vector3.Distance(source, destination) > speed * MOVEMENT_DISTANCE_TOLERANCE_PERCENT)
38 return MovementValidity.MovedTooFar;
ModelViewerSnappedFactory.Cuboid.cs (https://bitbucket.org/alexshtf/sketchmodeller.git) C# · 55 lines
39 geometry = meshBuilder.ToMesh();
40 visual.Children.Add(CreateVisual(geometry, Brushes.Blue));*/
41 Debug.WriteLine(string.Format("After : W*H={0}", Vector3D.DotProduct(cuboidData.Wresult, cuboidData.Hresult)));
42 Debug.WriteLine(string.Format("After : W*D={0}", Vector3D.DotProduct(cuboidData.Wresult, cuboidData.Dresult)));
43 Debug.WriteLine(string.Format("After : D*H={0}", Vector3D.DotProduct(cuboidData.Dresult, cuboidData.Hresult)));
45 //meshBuilder = new MeshBuilder(true, true);
MovingAction.cs (https://bitbucket.org/gorkasg/boxoban.git) C# · 169 lines
Player1attributes.cs (https://bitbucket.org/golivegaming/lalkamal-neelkamal.git) C# · 78 lines
21 HeroAnimation = gameObject.GetComponent("Animation") as Animation;
22 //give movement to the hero
23 this.gameObject.transform.Translate(Vector3.forward *Time.smoothDeltaTime * GlobalAttributes.HeroWalkSpeed);
24 // Initlize enemy at particular distance from hero
25 if(GlobalAttributes.EnemyLife == 0)
CameraControl.cs (https://bitbucket.org/Codwa/battalion-of-reckless-renegades.git) C# · 169 lines
20 public float cameraOffsetY;
21 public float cameraOffsetZ;
22 public Vector3 bossPosition;
24 //Boss Camera variables
89 else {
90 if(facingRight)
91 camera.transform.position = Vector3.Lerp(camera.transform.position,new Vector3(player.position.x + cameraOffsetX1, cameraOffsetY, cameraOffsetZ),time);
92 else
93 camera.transform.position = Vector3.Lerp(camera.transform.position,new Vector3(player.position.x + cameraOffsetX2, cameraOffsetY, cameraOffsetZ),time);
103 {
104 if(facingRight)
105 camera.transform.position = Vector3.Lerp(camera.transform.position,new Vector3(player.position.x + cameraOffsetX1, cameraOffsetY, cameraOffsetZ),time);
106 else
107 camera.transform.position = Vector3.Lerp(camera.transform.position,new Vector3(player.position.x + cameraOffsetX2, cameraOffsetY, cameraOffsetZ),time);
SlopeTexture.cs (https://bitbucket.org/kubrakms/thermalconductivity.git) C# · 90 lines
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="SlopeTexture.cs" company="Helix 3D Toolkit">
3 // http://helixtoolkit.codeplex.com, license: Ms-PL
4 // </copyright>
64 var normals = MeshGeometryHelper.CalculateNormals(mesh);
65 var texcoords = new PointCollection();
66 var up = new Vector3D(0, 0, 1);
67 for (int i = 0; i < normals.Count; i++)
68 {
69 double slope = Math.Acos(Vector3D.DotProduct(normals[i], up)) * 180 / Math.PI;
70 double u = slope / 40;
71 if (u > 1)
ZSCoreDiagnosticWindow.cs (https://bitbucket.org/willderness/3dphysicsbook.git) C# · 262 lines
41 // Read Only Members
42 public Vector3 m_displayOffset = Vector3.zero;
43 public Vector2 m_displayPosition = Vector2.zero;
44 public Vector2 m_displayAngle = Vector2.zero;
46 public Vector2 m_displaySize = Vector2.zero;
48 public Vector3 m_headPosition = Vector3.zero;
49 public Vector3 m_headDirection = Vector3.zero;
50 public Vector3 m_headCameraPosition = Vector3.zero;
51 public Vector3 m_headCameraDirection = Vector3.zero;
52 public Vector3 m_headWorldPosition = Vector3.zero;
53 public Vector3 m_headWorldDirection = Vector3.zero;
GazeStabilizer.cs (https://bitbucket.org/andrewaac/single-image-target-detection.git) C# · 219 lines
73 {
74 gazePosition = position;
75 gazeDirection = rotation * Vector3.forward;
77 AddGazeSample(gazePosition, gazeDirection);
90 }
92 private void AddGazeSample(Vector3 positionSample, Vector3 directionSample)
93 {
94 // Record and save sample data.
208 if (normalizedGazeToGravityWellDirection > 1.0f)
209 {
210 gravityWellDirection = Vector3.Normalize(gazeDirection - Vector3.Normalize(gazeDirection - gravityWellDirection) * stabilityModifiedDirectionDropOffDistance);
211 }
CustomTypes.cs (https://bitbucket.org/edofrank/unity3d-fpsphotoncloud-beta.git) C# · 148 lines
19 {
20 PhotonPeer.RegisterType(typeof(Vector2), (byte)'W', SerializeVector2, DeserializeVector2);
21 PhotonPeer.RegisterType(typeof(Vector3), (byte)'V', SerializeVector3, DeserializeVector3);
22 PhotonPeer.RegisterType(typeof(Transform), (byte)'T', SerializeTransform, DeserializeTransform);
23 PhotonPeer.RegisterType(typeof(Quaternion), (byte)'Q', SerializeQuaternion, DeserializeQuaternion);
32 Transform t = (Transform)customobject;
34 Vector3[] parts = new Vector3[2];
35 parts[0] = t.position;
36 parts[1] = t.eulerAngles;
47 private static byte[] SerializeVector3(object customobject)
48 {
49 Vector3 vo = (Vector3)customobject;
50 MemoryStream ms = new MemoryStream(3 * 4);
MegaWorldPathDeformEditor.cs (https://bitbucket.org/isereda_visco/vuforiademoiosbuild.git) C# · 112 lines
53 mod.stretchCurve = EditorGUILayout.CurveField("Stretch Curve", mod.stretchCurve);
55 mod.Up = EditorGUILayout.Vector3Field("Up", mod.Up);
56 return false;
57 }
75 int lk = -1;
77 Vector3 first = pd.path.splines[s].Interpolate(0.0f, pd.path.normalizedInterp, ref lk);
79 for ( float dist = ds; dist < pd.path.splines[s].length; dist += ds )
80 {
81 float alpha = dist / pd.path.splines[s].length;
82 Vector3 pos = pd.path.splines[s].Interpolate(alpha, pd.path.normalizedInterp, ref k);
84 if ( k != lk )
Modifiers.cs (https://bitbucket.org/z_ul-abdeen/thirdyearprojectunity.git) C# · 274 lines
27 }
29 public Vector3[] Apply (Node[] path, Vector3 start, Vector3 end, int startIndex, int endIndex, NavGraph graph) {
31 return GetModifier ().Apply (path,start,end, startIndex, endIndex, graph);
32 }
34 public Vector3[] Apply (Vector3[] path, Vector3 start, Vector3 end) {
36 return GetModifier ().Apply (path, start, end);
197 * This is for all other position only modifiers (mostly smoothers) */
198 [System.Obsolete]
199 public virtual Vector3[] Apply (Vector3[] path, Vector3 start, Vector3 end) {
200 return path;
201 }
TownCreator.cs (https://bitbucket.org/timur_rakhmanov/cloudbuild.git) C# · 103 lines
24 void OnGUI() {
25 GUI.Label(new Rect(2,2,400,400), "Very simple example of generating objects that are defined by XML files at runtime.\n\nIt uses 2 prototype of a house and a roof (ok, they are simple cubes in this example, but thats not the point).\n\nAn XML file is downloaded, the XML is parsed and gameobject are created and configured.\nHave a look in the file TownCreator.cs and Town.xml");
26 }
73 // element.transform.SetParent( house.transform );
74 element.transform.parent = house.transform;
75 element.transform.localPosition = elementDefinition.GetVector3( "offset" );
76 element.GetComponent<MeshRenderer>().material.color = elementDefinition.GetColor( "color" );
77 }
80 // position the house
81 house.transform.position = houseDefinition.GetVector3( "position" );
83 // scale the house
DCB.cs (https://bitbucket.org/x893/sirflive.git) C# · 253 lines
11 private uint DCBlength;
12 public uint BaudRate;
13 private BitVector32 Control;
14 internal ushort wReserved;
15 public ushort XonLim;
24 public sbyte EvtChar;
25 internal ushort wReserved1;
26 private readonly BitVector32.Section sect1;
27 private readonly BitVector32.Section DTRsect;
28 private readonly BitVector32.Section sect2;
29 private readonly BitVector32.Section RTSsect;
31 {
32 this.DCBlength = (uint) Marshal.SizeOf(this);
33 this.Control = new BitVector32(0);
34 this.sect1 = BitVector32.CreateSection(15);
InGameVertexPaint.cs (https://bitbucket.org/lostfictions/vertexpainting.git) C# · 101 lines
73 int i2 = triangles[hit.triangleIndex * 3 + 2];
75 Vector3 bary = hit.barycentricCoordinate;
77 colors[i0] = Color32.Lerp(colors[i0], color, bary.x * strength / 100f);
85 var vertices = mesh.vertices;
86 Transform hitTransform = hit.transform;
87 Vector3 p0 = hitTransform.TransformPoint(vertices[i0]);
88 Vector3 p1 = hitTransform.TransformPoint(vertices[i1]);
89 Vector3 p2 = hitTransform.TransformPoint(vertices[i2]);
90 Debug.DrawLine(p0, p1, Color.red, 0, false);
91 Debug.DrawLine(p1, p2, Color.red, 0, false);