aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-09 01:11:41 +0000
committerJustin Clark-Casey (justincc)2013-02-09 01:11:41 +0000
commit6935bec0ab83f25f69ad08e9bbc4b8d98aac1b1b (patch)
tree647e2ce5747ad8992111e9e89aefa825bffbbef2 /OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
parentChange TestDestroyStore() and TestJsonRemoveValue() to reflect the fact that ... (diff)
parentBulletSim: add parameter to set global contact breaking threshold. Update DLL... (diff)
downloadopensim-SC_OLD-6935bec0ab83f25f69ad08e9bbc4b8d98aac1b1b.zip
opensim-SC_OLD-6935bec0ab83f25f69ad08e9bbc4b8d98aac1b1b.tar.gz
opensim-SC_OLD-6935bec0ab83f25f69ad08e9bbc4b8d98aac1b1b.tar.bz2
opensim-SC_OLD-6935bec0ab83f25f69ad08e9bbc4b8d98aac1b1b.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs118
1 files changed, 118 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
new file mode 100755
index 0000000..6401308
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs
@@ -0,0 +1,118 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * The quotations from http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial
28 * are Copyright (c) 2009 Linden Research, Inc and are used under their license
29 * of Creative Commons Attribution-Share Alike 3.0
30 * (http://creativecommons.org/licenses/by-sa/3.0/).
31 */
32
33using System;
34using System.Collections.Generic;
35using System.Reflection;
36using System.Runtime.InteropServices;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Region.Physics.Manager;
40
41using OMV = OpenMetaverse;
42
43namespace OpenSim.Region.Physics.BulletSPlugin
44{
45public class BSPrimDisplaced : BSPrim
46{
47 // 'Position' and 'Orientation' is what the simulator thinks the positions of the prim is.
48 // Because Bullet needs the zero coordinate to be the center of mass of the linkset,
49 // sometimes it is necessary to displace the position the physics engine thinks
50 // the position is. PositionDisplacement must be added and removed from the
51 // position as the simulator position is stored and fetched from the physics
52 // engine. Similar to OrientationDisplacement.
53 public virtual OMV.Vector3 PositionDisplacement { get; set; }
54 public virtual OMV.Quaternion OrientationDisplacement { get; set; }
55 public virtual OMV.Vector3 CenterOfMassLocation { get; set; }
56 public virtual OMV.Vector3 GeometricCenterLocation { get; set; }
57
58 public BSPrimDisplaced(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
59 OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
60 : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical)
61 {
62 CenterOfMassLocation = RawPosition;
63 GeometricCenterLocation = RawPosition;
64 }
65
66 public override Vector3 ForcePosition
67 {
68 get
69 {
70 return base.ForcePosition;
71 }
72 set
73 {
74 base.ForcePosition = value;
75 CenterOfMassLocation = RawPosition;
76 GeometricCenterLocation = RawPosition;
77 }
78 }
79
80 public override Quaternion ForceOrientation
81 {
82 get
83 {
84 return base.ForceOrientation;
85 }
86 set
87 {
88 base.ForceOrientation = value;
89 }
90 }
91
92 // Is this used?
93 public override OMV.Vector3 CenterOfMass
94 {
95 get { return CenterOfMassLocation; }
96 }
97
98 // Is this used?
99 public override OMV.Vector3 GeometricCenter
100 {
101 get { return GeometricCenterLocation; }
102 }
103
104
105 public override void UpdateProperties(EntityProperties entprop)
106 {
107 // Undo any center-of-mass displacement that might have been done.
108 if (PositionDisplacement != OMV.Vector3.Zero)
109 {
110 // Correct for any rotation around the center-of-mass
111 // TODO!!!
112 entprop.Position -= PositionDisplacement;
113 }
114
115 base.UpdateProperties(entprop);
116 }
117}
118}