diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/DefaultMotionState.cs | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/DefaultMotionState.cs b/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/DefaultMotionState.cs index 2a45a20..73dc675 100644 --- a/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/DefaultMotionState.cs +++ b/libraries/ModifiedBulletX/ModifiedBulletX/LinearMath/DefaultMotionState.cs | |||
@@ -1,66 +1,66 @@ | |||
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 | ||
22 | using System; | 22 | using System; |
23 | using System.Collections.Generic; | 23 | using System.Collections.Generic; |
24 | using System.Text; | 24 | using System.Text; |
25 | using MonoXnaCompactMaths; | 25 | using MonoXnaCompactMaths; |
26 | 26 | ||
27 | namespace XnaDevRu.BulletX | 27 | namespace XnaDevRu.BulletX |
28 | { | 28 | { |
29 | // DefaultMotionState provides a common implementation to synchronize world transforms with offsets | 29 | // DefaultMotionState provides a common implementation to synchronize world transforms with offsets |
30 | public class DefaultMotionState : MotionState | 30 | public class DefaultMotionState : MotionState |
31 | { | 31 | { |
32 | private Matrix _graphicsWorldTransform; | 32 | private Matrix _graphicsWorldTransform; |
33 | private Matrix _centerOfMassOffset; | 33 | private Matrix _centerOfMassOffset; |
34 | private Matrix _startWorldTransform; | 34 | private Matrix _startWorldTransform; |
35 | private object _userData; | 35 | private object _userData; |
36 | 36 | ||
37 | public DefaultMotionState() | 37 | public DefaultMotionState() |
38 | : this(Matrix.Identity, Matrix.Identity) { } | 38 | : this(Matrix.Identity, Matrix.Identity) { } |
39 | 39 | ||
40 | public DefaultMotionState(Matrix startTransform, Matrix centerOfMassOffset) | 40 | public DefaultMotionState(Matrix startTransform, Matrix centerOfMassOffset) |
41 | { | 41 | { |
42 | _graphicsWorldTransform = startTransform; | 42 | _graphicsWorldTransform = startTransform; |
43 | _centerOfMassOffset = centerOfMassOffset; | 43 | _centerOfMassOffset = centerOfMassOffset; |
44 | _startWorldTransform = startTransform; | 44 | _startWorldTransform = startTransform; |
45 | } | 45 | } |
46 | 46 | ||
47 | public Matrix GraphicsWorldTransform { get { return _graphicsWorldTransform; } set { _graphicsWorldTransform = value; } } | 47 | public Matrix GraphicsWorldTransform { get { return _graphicsWorldTransform; } set { _graphicsWorldTransform = value; } } |
48 | public Matrix CenterOfMassOffset { get { return _centerOfMassOffset; } set { _centerOfMassOffset = value; } } | 48 | public Matrix CenterOfMassOffset { get { return _centerOfMassOffset; } set { _centerOfMassOffset = value; } } |
49 | public Matrix StartWorldTransform { get { return _startWorldTransform; } set { _startWorldTransform = value; } } | 49 | public Matrix StartWorldTransform { get { return _startWorldTransform; } set { _startWorldTransform = value; } } |
50 | public object UserData { get { return _userData; } set { _userData = value; } } | 50 | public object UserData { get { return _userData; } set { _userData = value; } } |
51 | 51 | ||
52 | // synchronizes world transform from user to physics | 52 | // synchronizes world transform from user to physics |
53 | public override void GetWorldTransform(out Matrix centerOfMassWorldTrans) | 53 | public override void GetWorldTransform(out Matrix centerOfMassWorldTrans) |
54 | { | 54 | { |
55 | centerOfMassWorldTrans = MathHelper.InvertMatrix(_centerOfMassOffset) * _graphicsWorldTransform; | 55 | centerOfMassWorldTrans = MathHelper.InvertMatrix(_centerOfMassOffset) * _graphicsWorldTransform; |
56 | } | 56 | } |
57 | 57 | ||
58 | // synchronizes world transform from physics to user | 58 | // synchronizes world transform from physics to user |
59 | // Bullet only calls the update of worldtransform for active objects | 59 | // Bullet only calls the update of worldtransform for active objects |
60 | public override void SetWorldTransform(Matrix centerOfMassWorldTrans) | 60 | public override void SetWorldTransform(Matrix centerOfMassWorldTrans) |
61 | { | 61 | { |
62 | _graphicsWorldTransform = MatrixOperations.Multiply(centerOfMassWorldTrans, _centerOfMassOffset); | 62 | _graphicsWorldTransform = MatrixOperations.Multiply(centerOfMassWorldTrans, _centerOfMassOffset); |
63 | _graphicsWorldTransform.Translation = centerOfMassWorldTrans.Translation; | 63 | _graphicsWorldTransform.Translation = centerOfMassWorldTrans.Translation; |
64 | } | 64 | } |
65 | } | 65 | } |
66 | } | 66 | } |