aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs')
-rw-r--r--libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs186
1 files changed, 93 insertions, 93 deletions
diff --git a/libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs b/libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs
index 90db9ee..4e0e64b 100644
--- a/libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs
+++ b/libraries/ModifiedBulletX/ModifiedBulletX/Dynamics/Vehicle/RaycastVehicle.cs
@@ -1,94 +1,94 @@
1/* 1/*
2 Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru 2 Bullet for XNA Copyright (c) 2003-2007 Vsevolod Klementjev http://www.codeplex.com/xnadevru
3 Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com 3 Bullet original C++ version Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
4 4
5 This software is provided 'as-is', without any express or implied 5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages 6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software. 7 arising from the use of this software.
8 8
9 Permission is granted to anyone to use this software for any purpose, 9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it 10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions: 11 freely, subject to the following restrictions:
12 12
13 1. The origin of this software must not be misrepresented; you must not 13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software 14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be 15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required. 16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be 17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software. 18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution. 19 3. This notice may not be removed or altered from any source distribution.
20*/ 20*/
21 21
22using System; 22using System;
23using System.Collections.Generic; 23using System.Collections.Generic;
24using System.Text; 24using System.Text;
25using MonoXnaCompactMaths; 25using MonoXnaCompactMaths;
26 26
27namespace XnaDevRu.BulletX.Dynamics 27namespace XnaDevRu.BulletX.Dynamics
28{ 28{
29 public class RaycastVehicle : TypedConstraint 29 public class RaycastVehicle : TypedConstraint
30 { 30 {
31 public override void BuildJacobian() 31 public override void BuildJacobian()
32 { 32 {
33 throw new Exception("The method or operation is not implemented."); 33 throw new Exception("The method or operation is not implemented.");
34 } 34 }
35 35
36 public override void SolveConstraint(float timeStep) 36 public override void SolveConstraint(float timeStep)
37 { 37 {
38 throw new Exception("The method or operation is not implemented."); 38 throw new Exception("The method or operation is not implemented.");
39 } 39 }
40 40
41 public int getNumWheels() 41 public int getNumWheels()
42 { 42 {
43 throw new Exception("The method or operation is not implemented."); 43 throw new Exception("The method or operation is not implemented.");
44 } 44 }
45 45
46 public WheelInfo getWheelInfo(int v) 46 public WheelInfo getWheelInfo(int v)
47 { 47 {
48 throw new Exception("The method or operation is not implemented."); 48 throw new Exception("The method or operation is not implemented.");
49 } 49 }
50 50
51 public void updateWheelTransform(int v, bool p) 51 public void updateWheelTransform(int v, bool p)
52 { 52 {
53 throw new Exception("The method or operation is not implemented."); 53 throw new Exception("The method or operation is not implemented.");
54 } 54 }
55 55
56 public int getRightAxis() 56 public int getRightAxis()
57 { 57 {
58 throw new Exception("The method or operation is not implemented."); 58 throw new Exception("The method or operation is not implemented.");
59 } 59 }
60 60
61 public void updateVehicle(float timeStep) 61 public void updateVehicle(float timeStep)
62 { 62 {
63 throw new Exception("The method or operation is not implemented."); 63 throw new Exception("The method or operation is not implemented.");
64 } 64 }
65 } 65 }
66 66
67 public class DefaultVehicleRaycaster : IVehicleRaycaster 67 public class DefaultVehicleRaycaster : IVehicleRaycaster
68 { 68 {
69 DynamicsWorld _dynamicsWorld; 69 DynamicsWorld _dynamicsWorld;
70 70
71 public DefaultVehicleRaycaster(DynamicsWorld world) 71 public DefaultVehicleRaycaster(DynamicsWorld world)
72 { 72 {
73 _dynamicsWorld = world; 73 _dynamicsWorld = world;
74 } 74 }
75 75
76 public object CastRay(Vector3 from, Vector3 to, out VehicleRaycasterResult result) 76 public object CastRay(Vector3 from, Vector3 to, out VehicleRaycasterResult result)
77 { 77 {
78 CollisionWorld.ClosestRayResultCallback rayCallback = new CollisionWorld.ClosestRayResultCallback(from, to); 78 CollisionWorld.ClosestRayResultCallback rayCallback = new CollisionWorld.ClosestRayResultCallback(from, to);
79 _dynamicsWorld.RayTest(from, to, rayCallback); 79 _dynamicsWorld.RayTest(from, to, rayCallback);
80 80
81 result = new VehicleRaycasterResult(); 81 result = new VehicleRaycasterResult();
82 82
83 if (!rayCallback.HasHit) return 0; 83 if (!rayCallback.HasHit) return 0;
84 RigidBody body = RigidBody.Upcast(rayCallback.CollisionObject); 84 RigidBody body = RigidBody.Upcast(rayCallback.CollisionObject);
85 if (body == null) return 0; 85 if (body == null) return 0;
86 86
87 result.HitPointInWorld = rayCallback.HitPointWorld; 87 result.HitPointInWorld = rayCallback.HitPointWorld;
88 result.HitNormalInWorld = rayCallback.HitNormalWorld; 88 result.HitNormalInWorld = rayCallback.HitNormalWorld;
89 result.HitNormalInWorld.Normalize(); 89 result.HitNormalInWorld.Normalize();
90 result.DistFraction = rayCallback.ClosestHitFraction; 90 result.DistFraction = rayCallback.ClosestHitFraction;
91 return body; 91 return body;
92 } 92 }
93 } 93 }
94} \ No newline at end of file 94} \ No newline at end of file