diff options
Diffstat (limited to '')
5 files changed, 571 insertions, 300 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs index b1a3ff9..e43136a 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs | |||
@@ -36,13 +36,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
36 | { | 36 | { |
37 | public class BasicActor : PhysicsActor | 37 | public class BasicActor : PhysicsActor |
38 | { | 38 | { |
39 | private Vector3 _position; | ||
40 | private Vector3 _velocity; | ||
41 | private Vector3 _acceleration; | ||
42 | private Vector3 _size; | 39 | private Vector3 _size; |
43 | private Vector3 m_rotationalVelocity; | ||
44 | private bool flying; | ||
45 | private bool iscolliding; | ||
46 | 40 | ||
47 | public BasicActor(Vector3 size) | 41 | public BasicActor(Vector3 size) |
48 | { | 42 | { |
@@ -55,11 +49,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
55 | set { return; } | 49 | set { return; } |
56 | } | 50 | } |
57 | 51 | ||
58 | public override Vector3 RotationalVelocity | 52 | public override Vector3 RotationalVelocity { get; set; } |
59 | { | ||
60 | get { return m_rotationalVelocity; } | ||
61 | set { m_rotationalVelocity = value; } | ||
62 | } | ||
63 | 53 | ||
64 | public override bool SetAlwaysRun | 54 | public override bool SetAlwaysRun |
65 | { | 55 | { |
@@ -105,17 +95,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
105 | set { return; } | 95 | set { return; } |
106 | } | 96 | } |
107 | 97 | ||
108 | public override bool Flying | 98 | public override bool Flying { get; set; } |
109 | { | ||
110 | get { return flying; } | ||
111 | set { flying = value; } | ||
112 | } | ||
113 | 99 | ||
114 | public override bool IsColliding | 100 | public override bool IsColliding { get; set; } |
115 | { | ||
116 | get { return iscolliding; } | ||
117 | set { iscolliding = value; } | ||
118 | } | ||
119 | 101 | ||
120 | public override bool CollidingGround | 102 | public override bool CollidingGround |
121 | { | 103 | { |
@@ -134,11 +116,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
134 | get { return false; } | 116 | get { return false; } |
135 | } | 117 | } |
136 | 118 | ||
137 | public override Vector3 Position | 119 | public override Vector3 Position { get; set; } |
138 | { | ||
139 | get { return _position; } | ||
140 | set { _position = value; } | ||
141 | } | ||
142 | 120 | ||
143 | public override Vector3 Size | 121 | public override Vector3 Size |
144 | { | 122 | { |
@@ -206,11 +184,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
206 | get { return Vector3.Zero; } | 184 | get { return Vector3.Zero; } |
207 | } | 185 | } |
208 | 186 | ||
209 | public override Vector3 Velocity | 187 | public override Vector3 Velocity { get; set; } |
210 | { | ||
211 | get { return _velocity; } | ||
212 | set { _velocity = value; } | ||
213 | } | ||
214 | 188 | ||
215 | public override Vector3 Torque | 189 | public override Vector3 Torque |
216 | { | 190 | { |
@@ -230,11 +204,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
230 | set { } | 204 | set { } |
231 | } | 205 | } |
232 | 206 | ||
233 | public override Vector3 Acceleration | 207 | public override Vector3 Acceleration { get; set; } |
234 | { | ||
235 | get { return _acceleration; } | ||
236 | set { _acceleration = value; } | ||
237 | } | ||
238 | 208 | ||
239 | public override bool Kinematic | 209 | public override bool Kinematic |
240 | { | 210 | { |
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs new file mode 100644 index 0000000..b89eeed --- /dev/null +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs | |||
@@ -0,0 +1,314 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using Nini.Config; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Region.Physics.Manager; | ||
34 | |||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | ||
36 | { | ||
37 | public class BasicPhysicsPrim : PhysicsActor | ||
38 | { | ||
39 | private Vector3 _size; | ||
40 | private PrimitiveBaseShape _shape; | ||
41 | |||
42 | public BasicPhysicsPrim( | ||
43 | string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape) | ||
44 | { | ||
45 | Name = name; | ||
46 | LocalID = localId; | ||
47 | Position = position; | ||
48 | Size = size; | ||
49 | Orientation = orientation; | ||
50 | Shape = shape; | ||
51 | } | ||
52 | |||
53 | public override int PhysicsActorType | ||
54 | { | ||
55 | get { return (int) ActorTypes.Agent; } | ||
56 | set { return; } | ||
57 | } | ||
58 | |||
59 | public override Vector3 RotationalVelocity { get; set; } | ||
60 | |||
61 | public override bool SetAlwaysRun | ||
62 | { | ||
63 | get { return false; } | ||
64 | set { return; } | ||
65 | } | ||
66 | |||
67 | public override uint LocalID | ||
68 | { | ||
69 | set { return; } | ||
70 | } | ||
71 | |||
72 | public override bool Grabbed | ||
73 | { | ||
74 | set { return; } | ||
75 | } | ||
76 | |||
77 | public override bool Selected | ||
78 | { | ||
79 | set { return; } | ||
80 | } | ||
81 | |||
82 | public override float Buoyancy | ||
83 | { | ||
84 | get { return 0f; } | ||
85 | set { return; } | ||
86 | } | ||
87 | |||
88 | public override bool FloatOnWater | ||
89 | { | ||
90 | set { return; } | ||
91 | } | ||
92 | |||
93 | public override bool IsPhysical | ||
94 | { | ||
95 | get { return false; } | ||
96 | set { return; } | ||
97 | } | ||
98 | |||
99 | public override bool ThrottleUpdates | ||
100 | { | ||
101 | get { return false; } | ||
102 | set { return; } | ||
103 | } | ||
104 | |||
105 | public override bool Flying { get; set; } | ||
106 | |||
107 | public override bool IsColliding { get; set; } | ||
108 | |||
109 | public override bool CollidingGround | ||
110 | { | ||
111 | get { return false; } | ||
112 | set { return; } | ||
113 | } | ||
114 | |||
115 | public override bool CollidingObj | ||
116 | { | ||
117 | get { return false; } | ||
118 | set { return; } | ||
119 | } | ||
120 | |||
121 | public override bool Stopped | ||
122 | { | ||
123 | get { return false; } | ||
124 | } | ||
125 | |||
126 | public override Vector3 Position { get; set; } | ||
127 | |||
128 | public override Vector3 Size | ||
129 | { | ||
130 | get { return _size; } | ||
131 | set { | ||
132 | _size = value; | ||
133 | _size.Z = _size.Z / 2.0f; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public override PrimitiveBaseShape Shape | ||
138 | { | ||
139 | set { _shape = value; } | ||
140 | } | ||
141 | |||
142 | public override float Mass | ||
143 | { | ||
144 | get { return 0f; } | ||
145 | } | ||
146 | |||
147 | public override Vector3 Force | ||
148 | { | ||
149 | get { return Vector3.Zero; } | ||
150 | set { return; } | ||
151 | } | ||
152 | |||
153 | public override int VehicleType | ||
154 | { | ||
155 | get { return 0; } | ||
156 | set { return; } | ||
157 | } | ||
158 | |||
159 | public override void VehicleFloatParam(int param, float value) | ||
160 | { | ||
161 | |||
162 | } | ||
163 | |||
164 | public override void VehicleVectorParam(int param, Vector3 value) | ||
165 | { | ||
166 | |||
167 | } | ||
168 | |||
169 | public override void VehicleRotationParam(int param, Quaternion rotation) | ||
170 | { | ||
171 | |||
172 | } | ||
173 | |||
174 | public override void VehicleFlags(int param, bool remove) | ||
175 | { | ||
176 | |||
177 | } | ||
178 | |||
179 | public override void SetVolumeDetect(int param) | ||
180 | { | ||
181 | |||
182 | } | ||
183 | |||
184 | public override Vector3 CenterOfMass | ||
185 | { | ||
186 | get { return Vector3.Zero; } | ||
187 | } | ||
188 | |||
189 | public override Vector3 GeometricCenter | ||
190 | { | ||
191 | get { return Vector3.Zero; } | ||
192 | } | ||
193 | |||
194 | public override Vector3 Velocity { get; set; } | ||
195 | |||
196 | public override Vector3 Torque | ||
197 | { | ||
198 | get { return Vector3.Zero; } | ||
199 | set { return; } | ||
200 | } | ||
201 | |||
202 | public override float CollisionScore | ||
203 | { | ||
204 | get { return 0f; } | ||
205 | set { } | ||
206 | } | ||
207 | |||
208 | public override Quaternion Orientation { get; set; } | ||
209 | |||
210 | public override Vector3 Acceleration { get; set; } | ||
211 | |||
212 | public override bool Kinematic | ||
213 | { | ||
214 | get { return true; } | ||
215 | set { } | ||
216 | } | ||
217 | |||
218 | public override void link(PhysicsActor obj) | ||
219 | { | ||
220 | } | ||
221 | |||
222 | public override void delink() | ||
223 | { | ||
224 | } | ||
225 | |||
226 | public override void LockAngularMotion(Vector3 axis) | ||
227 | { | ||
228 | } | ||
229 | |||
230 | public override void AddForce(Vector3 force, bool pushforce) | ||
231 | { | ||
232 | } | ||
233 | |||
234 | public override void AddAngularForce(Vector3 force, bool pushforce) | ||
235 | { | ||
236 | } | ||
237 | |||
238 | public override void SetMomentum(Vector3 momentum) | ||
239 | { | ||
240 | } | ||
241 | |||
242 | public override void CrossingFailure() | ||
243 | { | ||
244 | } | ||
245 | |||
246 | public override Vector3 PIDTarget | ||
247 | { | ||
248 | set { return; } | ||
249 | } | ||
250 | |||
251 | public override bool PIDActive | ||
252 | { | ||
253 | set { return; } | ||
254 | } | ||
255 | |||
256 | public override float PIDTau | ||
257 | { | ||
258 | set { return; } | ||
259 | } | ||
260 | |||
261 | public override float PIDHoverHeight | ||
262 | { | ||
263 | set { return; } | ||
264 | } | ||
265 | |||
266 | public override bool PIDHoverActive | ||
267 | { | ||
268 | set { return; } | ||
269 | } | ||
270 | |||
271 | public override PIDHoverType PIDHoverType | ||
272 | { | ||
273 | set { return; } | ||
274 | } | ||
275 | |||
276 | public override float PIDHoverTau | ||
277 | { | ||
278 | set { return; } | ||
279 | } | ||
280 | |||
281 | public override Quaternion APIDTarget | ||
282 | { | ||
283 | set { return; } | ||
284 | } | ||
285 | |||
286 | public override bool APIDActive | ||
287 | { | ||
288 | set { return; } | ||
289 | } | ||
290 | |||
291 | public override float APIDStrength | ||
292 | { | ||
293 | set { return; } | ||
294 | } | ||
295 | |||
296 | public override float APIDDamping | ||
297 | { | ||
298 | set { return; } | ||
299 | } | ||
300 | |||
301 | public override void SubscribeEvents(int ms) | ||
302 | { | ||
303 | } | ||
304 | |||
305 | public override void UnSubscribeEvents() | ||
306 | { | ||
307 | } | ||
308 | |||
309 | public override bool SubscribedEvents() | ||
310 | { | ||
311 | return false; | ||
312 | } | ||
313 | } | ||
314 | } | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 2e14216..f5826ed 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -34,9 +34,17 @@ using OpenSim.Region.Physics.Manager; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | 35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin |
36 | { | 36 | { |
37 | /// <summary> | ||
38 | /// This is an incomplete extremely basic physics implementation | ||
39 | /// </summary> | ||
40 | /// <remarks> | ||
41 | /// Not useful for anything at the moment apart from some regression testing in other components where some form | ||
42 | /// of physics plugin is needed. | ||
43 | /// </remarks> | ||
37 | public class BasicScene : PhysicsScene | 44 | public class BasicScene : PhysicsScene |
38 | { | 45 | { |
39 | private List<BasicActor> _actors = new List<BasicActor>(); | 46 | private List<BasicActor> _actors = new List<BasicActor>(); |
47 | private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); | ||
40 | private float[] _heightMap; | 48 | private float[] _heightMap; |
41 | 49 | ||
42 | //protected internal string sceneIdentifier; | 50 | //protected internal string sceneIdentifier; |
@@ -50,10 +58,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
50 | { | 58 | { |
51 | } | 59 | } |
52 | 60 | ||
53 | public override void Dispose() | 61 | public override void Dispose() {} |
62 | |||
63 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
64 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
54 | { | 65 | { |
66 | BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs); | ||
67 | prim.IsPhysical = isPhysical; | ||
68 | |||
69 | _prims.Add(prim); | ||
55 | 70 | ||
71 | return prim; | ||
56 | } | 72 | } |
73 | |||
57 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | 74 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
58 | { | 75 | { |
59 | BasicActor act = new BasicActor(size); | 76 | BasicActor act = new BasicActor(size); |
@@ -63,30 +80,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
63 | return act; | 80 | return act; |
64 | } | 81 | } |
65 | 82 | ||
66 | public override void RemovePrim(PhysicsActor prim) | 83 | public override void RemovePrim(PhysicsActor actor) |
67 | { | 84 | { |
85 | BasicPhysicsPrim prim = (BasicPhysicsPrim)actor; | ||
86 | if (_prims.Contains(prim)) | ||
87 | _prims.Remove(prim); | ||
68 | } | 88 | } |
69 | 89 | ||
70 | public override void RemoveAvatar(PhysicsActor actor) | 90 | public override void RemoveAvatar(PhysicsActor actor) |
71 | { | 91 | { |
72 | BasicActor act = (BasicActor) actor; | 92 | BasicActor act = (BasicActor)actor; |
73 | if (_actors.Contains(act)) | 93 | if (_actors.Contains(act)) |
74 | { | ||
75 | _actors.Remove(act); | 94 | _actors.Remove(act); |
76 | } | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) | ||
81 | { | ||
82 | return null; | ||
83 | } | ||
84 | */ | ||
85 | |||
86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | ||
87 | Vector3 size, Quaternion rotation, bool isPhysical, uint localid) | ||
88 | { | ||
89 | return null; | ||
90 | } | 95 | } |
91 | 96 | ||
92 | public override void AddPhysicsActorTaint(PhysicsActor prim) | 97 | public override void AddPhysicsActorTaint(PhysicsActor prim) |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6f37347..5e8f4c6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -156,7 +156,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
156 | /// </summary> | 156 | /// </summary> |
157 | public IntPtr m_targetSpace = IntPtr.Zero; | 157 | public IntPtr m_targetSpace = IntPtr.Zero; |
158 | 158 | ||
159 | /// <summary> | ||
160 | /// The prim geometry, used for collision detection. | ||
161 | /// </summary> | ||
162 | /// <remarks> | ||
163 | /// This is never null except for a brief period when the geometry needs to be replaced (due to resizing or | ||
164 | /// mesh change) or when the physical prim is being removed from the scene. | ||
165 | /// </remarks> | ||
159 | public IntPtr prim_geom { get; private set; } | 166 | public IntPtr prim_geom { get; private set; } |
167 | |||
160 | public IntPtr _triMeshData { get; private set; } | 168 | public IntPtr _triMeshData { get; private set; } |
161 | 169 | ||
162 | private IntPtr _linkJointGroup = IntPtr.Zero; | 170 | private IntPtr _linkJointGroup = IntPtr.Zero; |
@@ -325,14 +333,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
325 | { | 333 | { |
326 | prim_geom = geom; | 334 | prim_geom = geom; |
327 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); | 335 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); |
328 | if (prim_geom != IntPtr.Zero) | ||
329 | { | ||
330 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
331 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
332 | 336 | ||
333 | _parent_scene.geom_name_map[prim_geom] = Name; | 337 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
334 | _parent_scene.actor_name_map[prim_geom] = this; | 338 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
335 | } | 339 | |
340 | _parent_scene.geom_name_map[prim_geom] = Name; | ||
336 | 341 | ||
337 | if (childPrim) | 342 | if (childPrim) |
338 | { | 343 | { |
@@ -765,11 +770,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
765 | m_collisionCategories &= ~CollisionCategories.Body; | 770 | m_collisionCategories &= ~CollisionCategories.Body; |
766 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 771 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
767 | 772 | ||
768 | if (prim_geom != IntPtr.Zero) | 773 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
769 | { | 774 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
770 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
771 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
772 | } | ||
773 | 775 | ||
774 | d.BodyDestroy(Body); | 776 | d.BodyDestroy(Body); |
775 | lock (childrenPrim) | 777 | lock (childrenPrim) |
@@ -793,11 +795,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
793 | m_collisionCategories &= ~CollisionCategories.Body; | 795 | m_collisionCategories &= ~CollisionCategories.Body; |
794 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 796 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
795 | 797 | ||
796 | if (prim_geom != IntPtr.Zero) | 798 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
797 | { | 799 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
798 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
799 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
800 | } | ||
801 | 800 | ||
802 | Body = IntPtr.Zero; | 801 | Body = IntPtr.Zero; |
803 | } | 802 | } |
@@ -864,10 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
864 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 863 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
865 | try | 864 | try |
866 | { | 865 | { |
867 | if (prim_geom == IntPtr.Zero) | 866 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); |
868 | { | ||
869 | SetGeom(d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null)); | ||
870 | } | ||
871 | } | 867 | } |
872 | catch (AccessViolationException) | 868 | catch (AccessViolationException) |
873 | { | 869 | { |
@@ -890,73 +886,67 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
890 | #if SPAM | 886 | #if SPAM |
891 | Console.WriteLine("ZProcessTaints for " + Name); | 887 | Console.WriteLine("ZProcessTaints for " + Name); |
892 | #endif | 888 | #endif |
889 | |||
890 | // This must be processed as the very first taint so that later operations have a prim_geom to work with | ||
891 | // if this is a new prim. | ||
893 | if (m_taintadd) | 892 | if (m_taintadd) |
894 | { | ||
895 | changeadd(); | 893 | changeadd(); |
896 | } | ||
897 | |||
898 | if (prim_geom != IntPtr.Zero) | ||
899 | { | ||
900 | if (!_position.ApproxEquals(m_taintposition, 0f)) | ||
901 | changemove(); | ||
902 | 894 | ||
903 | if (m_taintrot != _orientation) | 895 | if (!_position.ApproxEquals(m_taintposition, 0f)) |
904 | { | 896 | changemove(); |
905 | if (childPrim && IsPhysical) // For physical child prim... | 897 | |
906 | { | 898 | if (m_taintrot != _orientation) |
907 | rotate(); | 899 | { |
908 | // KF: ODE will also rotate the parent prim! | 900 | if (childPrim && IsPhysical) // For physical child prim... |
909 | // so rotate the root back to where it was | 901 | { |
910 | OdePrim parent = (OdePrim)_parent; | 902 | rotate(); |
911 | parent.rotate(); | 903 | // KF: ODE will also rotate the parent prim! |
912 | } | 904 | // so rotate the root back to where it was |
913 | else | 905 | OdePrim parent = (OdePrim)_parent; |
914 | { | 906 | parent.rotate(); |
915 | //Just rotate the prim | ||
916 | rotate(); | ||
917 | } | ||
918 | } | 907 | } |
919 | 908 | else | |
920 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | 909 | { |
921 | changePhysicsStatus(); | 910 | //Just rotate the prim |
911 | rotate(); | ||
912 | } | ||
913 | } | ||
914 | |||
915 | if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent)) | ||
916 | changePhysicsStatus(); | ||
922 | 917 | ||
923 | if (!_size.ApproxEquals(m_taintsize, 0f)) | 918 | if (!_size.ApproxEquals(m_taintsize, 0f)) |
924 | changesize(); | 919 | changesize(); |
925 | 920 | ||
926 | if (m_taintshape) | 921 | if (m_taintshape) |
927 | changeshape(); | 922 | changeshape(); |
928 | 923 | ||
929 | if (m_taintforce) | 924 | if (m_taintforce) |
930 | changeAddForce(); | 925 | changeAddForce(); |
931 | 926 | ||
932 | if (m_taintaddangularforce) | 927 | if (m_taintaddangularforce) |
933 | changeAddAngularForce(); | 928 | changeAddAngularForce(); |
934 | 929 | ||
935 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) | 930 | if (!m_taintTorque.ApproxEquals(Vector3.Zero, 0.001f)) |
936 | changeSetTorque(); | 931 | changeSetTorque(); |
937 | 932 | ||
938 | if (m_taintdisable) | 933 | if (m_taintdisable) |
939 | changedisable(); | 934 | changedisable(); |
940 | 935 | ||
941 | if (m_taintselected != m_isSelected) | 936 | if (m_taintselected != m_isSelected) |
942 | changeSelectedStatus(); | 937 | changeSelectedStatus(); |
943 | 938 | ||
944 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) | 939 | if (!m_taintVelocity.ApproxEquals(Vector3.Zero, 0.001f)) |
945 | changevelocity(); | 940 | changevelocity(); |
946 | 941 | ||
947 | if (m_taintparent != _parent) | 942 | if (m_taintparent != _parent) |
948 | changelink(); | 943 | changelink(); |
949 | 944 | ||
950 | if (m_taintCollidesWater != m_collidesWater) | 945 | if (m_taintCollidesWater != m_collidesWater) |
951 | changefloatonwater(); | 946 | changefloatonwater(); |
952 | 947 | ||
953 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) | 948 | if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) |
954 | changeAngularLock(); | 949 | changeAngularLock(); |
955 | } | ||
956 | else | ||
957 | { | ||
958 | m_log.ErrorFormat("[PHYSICS]: The scene reused a disposed PhysActor for {0}! *waves finger*, Don't be evil. A couple of things can cause this. An improper prim breakdown(be sure to set prim_geom to zero after d.GeomDestroy! An improper buildup (creating the geom failed). Or, the Scene Reused a physics actor after disposing it.)", Name); | ||
959 | } | ||
960 | } | 950 | } |
961 | 951 | ||
962 | /// <summary> | 952 | /// <summary> |
@@ -1052,150 +1042,146 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1052 | /// <param name="prim">Child prim</param> | 1042 | /// <param name="prim">Child prim</param> |
1053 | private void AddChildPrim(OdePrim prim) | 1043 | private void AddChildPrim(OdePrim prim) |
1054 | { | 1044 | { |
1055 | //Console.WriteLine("AddChildPrim " + Name); | 1045 | if (LocalID == prim.LocalID) |
1056 | if (LocalID != prim.LocalID) | 1046 | return; |
1047 | |||
1048 | if (Body == IntPtr.Zero) | ||
1057 | { | 1049 | { |
1058 | if (Body == IntPtr.Zero) | 1050 | Body = d.BodyCreate(_parent_scene.world); |
1051 | setMass(); | ||
1052 | } | ||
1053 | |||
1054 | lock (childrenPrim) | ||
1055 | { | ||
1056 | if (childrenPrim.Contains(prim)) | ||
1057 | return; | ||
1058 | |||
1059 | // m_log.DebugFormat( | ||
1060 | // "[ODE PRIM]: Linking prim {0} {1} to {2} {3}", prim.Name, prim.LocalID, Name, LocalID); | ||
1061 | |||
1062 | childrenPrim.Add(prim); | ||
1063 | |||
1064 | foreach (OdePrim prm in childrenPrim) | ||
1059 | { | 1065 | { |
1060 | Body = d.BodyCreate(_parent_scene.world); | 1066 | d.Mass m2; |
1061 | setMass(); | 1067 | d.MassSetZero(out m2); |
1068 | d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); | ||
1069 | |||
1070 | d.Quaternion quat = new d.Quaternion(); | ||
1071 | quat.W = prm._orientation.W; | ||
1072 | quat.X = prm._orientation.X; | ||
1073 | quat.Y = prm._orientation.Y; | ||
1074 | quat.Z = prm._orientation.Z; | ||
1075 | |||
1076 | d.Matrix3 mat = new d.Matrix3(); | ||
1077 | d.RfromQ(out mat, ref quat); | ||
1078 | d.MassRotate(ref m2, ref mat); | ||
1079 | d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z); | ||
1080 | d.MassAdd(ref pMass, ref m2); | ||
1062 | } | 1081 | } |
1063 | if (Body != IntPtr.Zero) | 1082 | |
1083 | foreach (OdePrim prm in childrenPrim) | ||
1064 | { | 1084 | { |
1065 | lock (childrenPrim) | 1085 | prm.m_collisionCategories |= CollisionCategories.Body; |
1066 | { | 1086 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1067 | if (!childrenPrim.Contains(prim)) | ||
1068 | { | ||
1069 | //Console.WriteLine("childrenPrim.Add " + prim); | ||
1070 | childrenPrim.Add(prim); | ||
1071 | |||
1072 | foreach (OdePrim prm in childrenPrim) | ||
1073 | { | ||
1074 | d.Mass m2; | ||
1075 | d.MassSetZero(out m2); | ||
1076 | d.MassSetBoxTotal(out m2, prim.CalculateMass(), prm._size.X, prm._size.Y, prm._size.Z); | ||
1077 | |||
1078 | d.Quaternion quat = new d.Quaternion(); | ||
1079 | quat.W = prm._orientation.W; | ||
1080 | quat.X = prm._orientation.X; | ||
1081 | quat.Y = prm._orientation.Y; | ||
1082 | quat.Z = prm._orientation.Z; | ||
1083 | |||
1084 | d.Matrix3 mat = new d.Matrix3(); | ||
1085 | d.RfromQ(out mat, ref quat); | ||
1086 | d.MassRotate(ref m2, ref mat); | ||
1087 | d.MassTranslate(ref m2, Position.X - prm.Position.X, Position.Y - prm.Position.Y, Position.Z - prm.Position.Z); | ||
1088 | d.MassAdd(ref pMass, ref m2); | ||
1089 | } | ||
1090 | |||
1091 | foreach (OdePrim prm in childrenPrim) | ||
1092 | { | ||
1093 | prm.m_collisionCategories |= CollisionCategories.Body; | ||
1094 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | ||
1095 | 1087 | ||
1096 | if (prm.prim_geom == IntPtr.Zero) | ||
1097 | { | ||
1098 | m_log.WarnFormat( | ||
1099 | "[PHYSICS]: Unable to link one of the linkset elements {0} for parent {1}. No geom yet", | ||
1100 | prm.Name, prim.Name); | ||
1101 | continue; | ||
1102 | } | ||
1103 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); | 1088 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); |
1104 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); | 1089 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); |
1105 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); | 1090 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); |
1106 | |||
1107 | 1091 | ||
1108 | d.Quaternion quat = new d.Quaternion(); | 1092 | d.Quaternion quat = new d.Quaternion(); |
1109 | quat.W = prm._orientation.W; | 1093 | quat.W = prm._orientation.W; |
1110 | quat.X = prm._orientation.X; | 1094 | quat.X = prm._orientation.X; |
1111 | quat.Y = prm._orientation.Y; | 1095 | quat.Y = prm._orientation.Y; |
1112 | quat.Z = prm._orientation.Z; | 1096 | quat.Z = prm._orientation.Z; |
1113 | 1097 | ||
1114 | d.Matrix3 mat = new d.Matrix3(); | 1098 | d.Matrix3 mat = new d.Matrix3(); |
1115 | d.RfromQ(out mat, ref quat); | 1099 | d.RfromQ(out mat, ref quat); |
1116 | if (Body != IntPtr.Zero) | 1100 | if (Body != IntPtr.Zero) |
1117 | { | 1101 | { |
1118 | d.GeomSetBody(prm.prim_geom, Body); | 1102 | d.GeomSetBody(prm.prim_geom, Body); |
1119 | prm.childPrim = true; | 1103 | prm.childPrim = true; |
1120 | d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z); | 1104 | d.GeomSetOffsetWorldPosition(prm.prim_geom, prm.Position.X , prm.Position.Y, prm.Position.Z); |
1121 | //d.GeomSetOffsetPosition(prim.prim_geom, | 1105 | //d.GeomSetOffsetPosition(prim.prim_geom, |
1122 | // (Position.X - prm.Position.X) - pMass.c.X, | 1106 | // (Position.X - prm.Position.X) - pMass.c.X, |
1123 | // (Position.Y - prm.Position.Y) - pMass.c.Y, | 1107 | // (Position.Y - prm.Position.Y) - pMass.c.Y, |
1124 | // (Position.Z - prm.Position.Z) - pMass.c.Z); | 1108 | // (Position.Z - prm.Position.Z) - pMass.c.Z); |
1125 | d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); | 1109 | d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); |
1126 | //d.GeomSetOffsetRotation(prm.prim_geom, ref mat); | 1110 | //d.GeomSetOffsetRotation(prm.prim_geom, ref mat); |
1127 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | 1111 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); |
1128 | d.BodySetMass(Body, ref pMass); | 1112 | d.BodySetMass(Body, ref pMass); |
1129 | } | 1113 | } |
1130 | else | 1114 | else |
1131 | { | 1115 | { |
1132 | m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name); | 1116 | m_log.DebugFormat("[PHYSICS]: {0} ain't got no boooooooooddy, no body", Name); |
1133 | } | 1117 | } |
1134 | 1118 | ||
1135 | prm.m_interpenetrationcount = 0; | 1119 | prm.m_interpenetrationcount = 0; |
1136 | prm.m_collisionscore = 0; | 1120 | prm.m_collisionscore = 0; |
1137 | prm.m_disabled = false; | 1121 | prm.m_disabled = false; |
1138 | 1122 | ||
1139 | // The body doesn't already have a finite rotation mode set here | 1123 | // The body doesn't already have a finite rotation mode set here |
1140 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | 1124 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) |
1141 | { | 1125 | { |
1142 | prm.createAMotor(m_angularlock); | 1126 | prm.createAMotor(m_angularlock); |
1143 | } | 1127 | } |
1144 | prm.Body = Body; | 1128 | prm.Body = Body; |
1145 | _parent_scene.ActivatePrim(prm); | 1129 | _parent_scene.ActivatePrim(prm); |
1146 | } | 1130 | } |
1147 | 1131 | ||
1148 | m_collisionCategories |= CollisionCategories.Body; | 1132 | m_collisionCategories |= CollisionCategories.Body; |
1149 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 1133 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1150 | 1134 | ||
1151 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); | 1135 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); |
1152 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1136 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1153 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); | 1137 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); |
1154 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1138 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1155 | |||
1156 | d.Quaternion quat2 = new d.Quaternion(); | ||
1157 | quat2.W = _orientation.W; | ||
1158 | quat2.X = _orientation.X; | ||
1159 | quat2.Y = _orientation.Y; | ||
1160 | quat2.Z = _orientation.Z; | ||
1161 | |||
1162 | d.Matrix3 mat2 = new d.Matrix3(); | ||
1163 | d.RfromQ(out mat2, ref quat2); | ||
1164 | d.GeomSetBody(prim_geom, Body); | ||
1165 | d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z); | ||
1166 | //d.GeomSetOffsetPosition(prim.prim_geom, | ||
1167 | // (Position.X - prm.Position.X) - pMass.c.X, | ||
1168 | // (Position.Y - prm.Position.Y) - pMass.c.Y, | ||
1169 | // (Position.Z - prm.Position.Z) - pMass.c.Z); | ||
1170 | //d.GeomSetOffsetRotation(prim_geom, ref mat2); | ||
1171 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | ||
1172 | d.BodySetMass(Body, ref pMass); | ||
1173 | |||
1174 | d.BodySetAutoDisableFlag(Body, true); | ||
1175 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | ||
1176 | 1139 | ||
1177 | m_interpenetrationcount = 0; | 1140 | d.Quaternion quat2 = new d.Quaternion(); |
1178 | m_collisionscore = 0; | 1141 | quat2.W = _orientation.W; |
1179 | m_disabled = false; | 1142 | quat2.X = _orientation.X; |
1143 | quat2.Y = _orientation.Y; | ||
1144 | quat2.Z = _orientation.Z; | ||
1180 | 1145 | ||
1181 | // The body doesn't already have a finite rotation mode set here | 1146 | d.Matrix3 mat2 = new d.Matrix3(); |
1182 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | 1147 | d.RfromQ(out mat2, ref quat2); |
1183 | { | 1148 | d.GeomSetBody(prim_geom, Body); |
1184 | createAMotor(m_angularlock); | 1149 | d.GeomSetOffsetWorldPosition(prim_geom, Position.X - pMass.c.X, Position.Y - pMass.c.Y, Position.Z - pMass.c.Z); |
1185 | } | 1150 | //d.GeomSetOffsetPosition(prim.prim_geom, |
1186 | d.BodySetPosition(Body, Position.X, Position.Y, Position.Z); | 1151 | // (Position.X - prm.Position.X) - pMass.c.X, |
1187 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | 1152 | // (Position.Y - prm.Position.Y) - pMass.c.Y, |
1188 | m_vehicle.Enable(Body, _parent_scene); | 1153 | // (Position.Z - prm.Position.Z) - pMass.c.Z); |
1154 | //d.GeomSetOffsetRotation(prim_geom, ref mat2); | ||
1155 | d.MassTranslate(ref pMass, -pMass.c.X, -pMass.c.Y, -pMass.c.Z); | ||
1156 | d.BodySetMass(Body, ref pMass); | ||
1189 | 1157 | ||
1190 | _parent_scene.ActivatePrim(this); | 1158 | d.BodySetAutoDisableFlag(Body, true); |
1191 | } | 1159 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
1192 | } | 1160 | |
1161 | m_interpenetrationcount = 0; | ||
1162 | m_collisionscore = 0; | ||
1163 | m_disabled = false; | ||
1164 | |||
1165 | // The body doesn't already have a finite rotation mode set here | ||
1166 | if ((!m_angularlock.ApproxEquals(Vector3.Zero, 0f)) && _parent == null) | ||
1167 | { | ||
1168 | createAMotor(m_angularlock); | ||
1193 | } | 1169 | } |
1170 | |||
1171 | d.BodySetPosition(Body, Position.X, Position.Y, Position.Z); | ||
1172 | |||
1173 | if (m_vehicle.Type != Vehicle.TYPE_NONE) | ||
1174 | m_vehicle.Enable(Body, _parent_scene); | ||
1175 | |||
1176 | _parent_scene.ActivatePrim(this); | ||
1194 | } | 1177 | } |
1195 | } | 1178 | } |
1196 | 1179 | ||
1197 | private void ChildSetGeom(OdePrim odePrim) | 1180 | private void ChildSetGeom(OdePrim odePrim) |
1198 | { | 1181 | { |
1182 | // m_log.DebugFormat( | ||
1183 | // "[ODE PRIM]: ChildSetGeom {0} {1} for {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID); | ||
1184 | |||
1199 | //if (IsPhysical && Body != IntPtr.Zero) | 1185 | //if (IsPhysical && Body != IntPtr.Zero) |
1200 | lock (childrenPrim) | 1186 | lock (childrenPrim) |
1201 | { | 1187 | { |
@@ -1210,12 +1196,14 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1210 | //prm.childPrim = false; | 1196 | //prm.childPrim = false; |
1211 | } | 1197 | } |
1212 | } | 1198 | } |
1199 | |||
1213 | disableBody(); | 1200 | disableBody(); |
1214 | 1201 | ||
1215 | if (Body != IntPtr.Zero) | 1202 | // Spurious - Body == IntPtr.Zero after disableBody() |
1216 | { | 1203 | // if (Body != IntPtr.Zero) |
1217 | _parent_scene.DeactivatePrim(this); | 1204 | // { |
1218 | } | 1205 | // _parent_scene.DeactivatePrim(this); |
1206 | // } | ||
1219 | 1207 | ||
1220 | lock (childrenPrim) | 1208 | lock (childrenPrim) |
1221 | { | 1209 | { |
@@ -1229,6 +1217,9 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1229 | 1217 | ||
1230 | private void ChildDelink(OdePrim odePrim) | 1218 | private void ChildDelink(OdePrim odePrim) |
1231 | { | 1219 | { |
1220 | // m_log.DebugFormat( | ||
1221 | // "[ODE PRIM]: Delinking prim {0} {1} from {2} {3}", odePrim.Name, odePrim.LocalID, Name, LocalID); | ||
1222 | |||
1232 | // Okay, we have a delinked child.. need to rebuild the body. | 1223 | // Okay, we have a delinked child.. need to rebuild the body. |
1233 | lock (childrenPrim) | 1224 | lock (childrenPrim) |
1234 | { | 1225 | { |
@@ -1243,6 +1234,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1243 | //prm.childPrim = false; | 1234 | //prm.childPrim = false; |
1244 | } | 1235 | } |
1245 | } | 1236 | } |
1237 | |||
1246 | disableBody(); | 1238 | disableBody(); |
1247 | 1239 | ||
1248 | lock (childrenPrim) | 1240 | lock (childrenPrim) |
@@ -1251,10 +1243,11 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1251 | childrenPrim.Remove(odePrim); | 1243 | childrenPrim.Remove(odePrim); |
1252 | } | 1244 | } |
1253 | 1245 | ||
1254 | if (Body != IntPtr.Zero) | 1246 | // Spurious - Body == IntPtr.Zero after disableBody() |
1255 | { | 1247 | // if (Body != IntPtr.Zero) |
1256 | _parent_scene.DeactivatePrim(this); | 1248 | // { |
1257 | } | 1249 | // _parent_scene.DeactivatePrim(this); |
1250 | // } | ||
1258 | 1251 | ||
1259 | lock (childrenPrim) | 1252 | lock (childrenPrim) |
1260 | { | 1253 | { |
@@ -1303,11 +1296,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1303 | disableBodySoft(); | 1296 | disableBodySoft(); |
1304 | } | 1297 | } |
1305 | 1298 | ||
1306 | if (prim_geom != IntPtr.Zero) | 1299 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1307 | { | 1300 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1308 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1309 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1310 | } | ||
1311 | 1301 | ||
1312 | if (IsPhysical) | 1302 | if (IsPhysical) |
1313 | { | 1303 | { |
@@ -1328,11 +1318,8 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1328 | if (m_collidesWater) | 1318 | if (m_collidesWater) |
1329 | m_collisionFlags |= CollisionCategories.Water; | 1319 | m_collisionFlags |= CollisionCategories.Water; |
1330 | 1320 | ||
1331 | if (prim_geom != IntPtr.Zero) | 1321 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
1332 | { | 1322 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
1333 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1334 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1335 | } | ||
1336 | 1323 | ||
1337 | if (IsPhysical) | 1324 | if (IsPhysical) |
1338 | { | 1325 | { |
@@ -1472,6 +1459,9 @@ Console.WriteLine("CreateGeom:"); | |||
1472 | } | 1459 | } |
1473 | else | 1460 | else |
1474 | { | 1461 | { |
1462 | m_log.WarnFormat( | ||
1463 | "[ODE PRIM]: Called RemoveGeom() on {0} {1} where geometry was already null.", Name, LocalID); | ||
1464 | |||
1475 | return false; | 1465 | return false; |
1476 | } | 1466 | } |
1477 | } | 1467 | } |
@@ -1505,16 +1495,13 @@ Console.WriteLine("changeadd 1"); | |||
1505 | #endif | 1495 | #endif |
1506 | CreateGeom(m_targetSpace, mesh); | 1496 | CreateGeom(m_targetSpace, mesh); |
1507 | 1497 | ||
1508 | if (prim_geom != IntPtr.Zero) | 1498 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1509 | { | 1499 | d.Quaternion myrot = new d.Quaternion(); |
1510 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1500 | myrot.X = _orientation.X; |
1511 | d.Quaternion myrot = new d.Quaternion(); | 1501 | myrot.Y = _orientation.Y; |
1512 | myrot.X = _orientation.X; | 1502 | myrot.Z = _orientation.Z; |
1513 | myrot.Y = _orientation.Y; | 1503 | myrot.W = _orientation.W; |
1514 | myrot.Z = _orientation.Z; | 1504 | d.GeomSetQuaternion(prim_geom, ref myrot); |
1515 | myrot.W = _orientation.W; | ||
1516 | d.GeomSetQuaternion(prim_geom, ref myrot); | ||
1517 | } | ||
1518 | 1505 | ||
1519 | if (IsPhysical && Body == IntPtr.Zero) | 1506 | if (IsPhysical && Body == IntPtr.Zero) |
1520 | enableBody(); | 1507 | enableBody(); |
@@ -1579,24 +1566,20 @@ Console.WriteLine(" JointCreateFixed"); | |||
1579 | //m_log.Debug("[BUG]: race!"); | 1566 | //m_log.Debug("[BUG]: race!"); |
1580 | //} | 1567 | //} |
1581 | } | 1568 | } |
1582 | else | ||
1583 | { | ||
1584 | // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); | ||
1585 | // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | ||
1586 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1587 | 1569 | ||
1588 | IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); | 1570 | // string primScenAvatarIn = _parent_scene.whichspaceamIin(_position); |
1589 | m_targetSpace = tempspace; | 1571 | // int[] arrayitem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
1572 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | ||
1573 | |||
1574 | IntPtr tempspace = _parent_scene.recalculateSpaceForGeom(prim_geom, _position, m_targetSpace); | ||
1575 | m_targetSpace = tempspace; | ||
1590 | 1576 | ||
1591 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 1577 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
1592 | if (prim_geom != IntPtr.Zero) | 1578 | |
1593 | { | 1579 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
1594 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
1595 | 1580 | ||
1596 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); | 1581 | // _parent_scene.waitForSpaceUnlock(m_targetSpace); |
1597 | d.SpaceAdd(m_targetSpace, prim_geom); | 1582 | d.SpaceAdd(m_targetSpace, prim_geom); |
1598 | } | ||
1599 | } | ||
1600 | 1583 | ||
1601 | changeSelectedStatus(); | 1584 | changeSelectedStatus(); |
1602 | 1585 | ||
@@ -2047,18 +2030,16 @@ Console.WriteLine(" JointCreateFixed"); | |||
2047 | { | 2030 | { |
2048 | m_collidesWater = m_taintCollidesWater; | 2031 | m_collidesWater = m_taintCollidesWater; |
2049 | 2032 | ||
2050 | if (prim_geom != IntPtr.Zero) | 2033 | if (m_collidesWater) |
2051 | { | 2034 | { |
2052 | if (m_collidesWater) | 2035 | m_collisionFlags |= CollisionCategories.Water; |
2053 | { | ||
2054 | m_collisionFlags |= CollisionCategories.Water; | ||
2055 | } | ||
2056 | else | ||
2057 | { | ||
2058 | m_collisionFlags &= ~CollisionCategories.Water; | ||
2059 | } | ||
2060 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
2061 | } | 2036 | } |
2037 | else | ||
2038 | { | ||
2039 | m_collisionFlags &= ~CollisionCategories.Water; | ||
2040 | } | ||
2041 | |||
2042 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
2062 | } | 2043 | } |
2063 | 2044 | ||
2064 | /// <summary> | 2045 | /// <summary> |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 842ff91..409b27b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -2226,7 +2226,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2226 | /// <param name="prim"></param> | 2226 | /// <param name="prim"></param> |
2227 | internal void RemovePrimThreadLocked(OdePrim prim) | 2227 | internal void RemovePrimThreadLocked(OdePrim prim) |
2228 | { | 2228 | { |
2229 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 2229 | // m_log.DebugFormat("[ODE SCENE]: Removing physical prim {0} {1}", prim.Name, prim.LocalID); |
2230 | |||
2230 | lock (prim) | 2231 | lock (prim) |
2231 | { | 2232 | { |
2232 | RemoveCollisionEventReporting(prim); | 2233 | RemoveCollisionEventReporting(prim); |