aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/ExtraPhysicsData.cs50
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs29
-rw-r--r--OpenSim/Region/Framework/Scenes/SOPMaterial.cs95
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs152
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs52
8 files changed, 361 insertions, 34 deletions
diff --git a/OpenSim/Framework/ExtraPhysicsData.cs b/OpenSim/Framework/ExtraPhysicsData.cs
new file mode 100644
index 0000000..9e7334f
--- /dev/null
+++ b/OpenSim/Framework/ExtraPhysicsData.cs
@@ -0,0 +1,50 @@
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
28using OpenMetaverse;
29
30namespace OpenSim.Framework
31{
32 public enum PhysShapeType : byte
33 {
34 prim = 0,
35 none = 1,
36 convex = 2,
37
38 invalid = 255 // use to mark invalid data in ExtraPhysicsData
39 }
40
41 public struct ExtraPhysicsData
42 {
43 public float Density;
44 public float GravitationModifier;
45 public float Friction;
46 public float Bounce;
47 public PhysShapeType PhysShapeType;
48
49 }
50}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 1bd4749..c70b2a0 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -124,7 +124,7 @@ namespace OpenSim.Framework
124 public delegate void ObjectDrop(uint localID, IClientAPI remoteClient); 124 public delegate void ObjectDrop(uint localID, IClientAPI remoteClient);
125 125
126 public delegate void UpdatePrimFlags( 126 public delegate void UpdatePrimFlags(
127 uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom, IClientAPI remoteClient); 127 uint localID, bool UsePhysics, bool IsTemporary, bool IsPhantom,ExtraPhysicsData PhysData, IClientAPI remoteClient);
128 128
129 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); 129 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
130 130
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 18af623..23beaec 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -7006,10 +7006,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7006 // 46,47,48 are special positions within the packet 7006 // 46,47,48 are special positions within the packet
7007 // This may change so perhaps we need a better way 7007 // This may change so perhaps we need a better way
7008 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?) 7008 // of storing this (OMV.FlagUpdatePacket.UsePhysics,etc?)
7009 bool UsePhysics = (data[46] != 0) ? true : false; 7009 /*
7010 bool IsTemporary = (data[47] != 0) ? true : false; 7010 bool UsePhysics = (data[46] != 0) ? true : false;
7011 bool IsPhantom = (data[48] != 0) ? true : false; 7011 bool IsTemporary = (data[47] != 0) ? true : false;
7012 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this); 7012 bool IsPhantom = (data[48] != 0) ? true : false;
7013 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, this);
7014 */
7015 bool UsePhysics = flags.AgentData.UsePhysics;
7016 bool IsPhantom = flags.AgentData.IsPhantom;
7017 bool IsTemporary = flags.AgentData.IsTemporary;
7018 ObjectFlagUpdatePacket.ExtraPhysicsBlock[] blocks = flags.ExtraPhysics;
7019 ExtraPhysicsData physdata = new ExtraPhysicsData();
7020
7021 if (blocks == null || blocks.Length == 0)
7022 {
7023 physdata.PhysShapeType = PhysShapeType.invalid;
7024 }
7025 else
7026 {
7027 ObjectFlagUpdatePacket.ExtraPhysicsBlock phsblock = blocks[0];
7028 physdata.PhysShapeType = (PhysShapeType)phsblock.PhysicsShapeType;
7029 physdata.Bounce = phsblock.Restitution;
7030 physdata.Density = phsblock.Density;
7031 physdata.Friction = phsblock.Friction;
7032 }
7033 handlerUpdatePrimFlags(flags.AgentData.ObjectLocalID, UsePhysics, IsTemporary, IsPhantom, physdata, this);
7013 } 7034 }
7014 return true; 7035 return true;
7015 } 7036 }
diff --git a/OpenSim/Region/Framework/Scenes/SOPMaterial.cs b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
new file mode 100644
index 0000000..10ac37c
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/SOPMaterial.cs
@@ -0,0 +1,95 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Region.Framework.Scenes
34{
35 public static class SOPMaterialData
36 {
37 public enum SopMaterial : int // redundante and not in use for now
38 {
39 Stone = 0,
40 Metal = 1,
41 Glass = 2,
42 Wood = 3,
43 Flesh = 4,
44 Plastic = 5,
45 Rubber = 6,
46 light = 7 // compatibility with old viewers
47 }
48
49 private struct MaterialData
50 {
51 public float friction;
52 public float bounce;
53 public MaterialData(float f, float b)
54 {
55 friction = f;
56 bounce = b;
57 }
58 }
59
60 private static MaterialData[] m_materialdata = {
61 new MaterialData(0.8f,0.4f), // Stone
62 new MaterialData(0.3f,0.4f), // Metal
63 new MaterialData(0.2f,0.7f), // Glass
64 new MaterialData(0.6f,0.5f), // Wood
65 new MaterialData(0.9f,0.3f), // Flesh
66 new MaterialData(0.4f,0.7f), // Plastic
67 new MaterialData(0.9f,0.95f), // Rubber
68 new MaterialData(0.0f,0.0f) // light ??
69 };
70
71 public static Material MaxMaterial
72 {
73 get { return (Material)(m_materialdata.Length - 1); }
74 }
75
76 public static float friction(Material material)
77 {
78 int indx = (int)material;
79 if (indx < m_materialdata.Length)
80 return (m_materialdata[indx].friction);
81 else
82 return 0;
83 }
84
85 public static float bounce(Material material)
86 {
87 int indx = (int)material;
88 if (indx < m_materialdata.Length)
89 return (m_materialdata[indx].bounce);
90 else
91 return 0;
92 }
93
94 }
95} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e6e3ad0..7b77ea0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1536,7 +1536,7 @@ namespace OpenSim.Region.Framework.Scenes
1536 /// <param name="SetPhantom"></param> 1536 /// <param name="SetPhantom"></param>
1537 /// <param name="remoteClient"></param> 1537 /// <param name="remoteClient"></param>
1538 protected internal void UpdatePrimFlags( 1538 protected internal void UpdatePrimFlags(
1539 uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, IClientAPI remoteClient) 1539 uint localID, bool UsePhysics, bool SetTemporary, bool SetPhantom, ExtraPhysicsData PhysData, IClientAPI remoteClient)
1540 { 1540 {
1541 SceneObjectGroup group = GetGroupByPrim(localID); 1541 SceneObjectGroup group = GetGroupByPrim(localID);
1542 if (group != null) 1542 if (group != null)
@@ -1544,7 +1544,14 @@ namespace OpenSim.Region.Framework.Scenes
1544 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1544 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId))
1545 { 1545 {
1546 // VolumeDetect can't be set via UI and will always be off when a change is made there 1546 // VolumeDetect can't be set via UI and will always be off when a change is made there
1547 group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false); 1547 if (PhysData.PhysShapeType == PhysShapeType.invalid)
1548 group.UpdatePrimFlags(localID, UsePhysics, SetTemporary, SetPhantom, false);
1549 else
1550 {
1551 SceneObjectPart part = GetSceneObjectPart(localID);
1552 if (part != null)
1553 part.UpdateExtraPhysics(PhysData);
1554 }
1548 } 1555 }
1549 } 1556 }
1550 } 1557 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 314705e..6feb333 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2556,7 +2556,7 @@ namespace OpenSim.Region.Framework.Scenes
2556 linkPart.CreateSelected = true; 2556 linkPart.CreateSelected = true;
2557 2557
2558 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now 2558 // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
2559 linkPart.UpdatePrimFlags(grpusephys, grptemporary, IsPhantom || ((linkPart.Flags & PrimFlags.Phantom) != null), linkPart.VolumeDetectActive, true); 2559 linkPart.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (linkPart.Flags & PrimFlags.Phantom) != 0), linkPart.VolumeDetectActive, true);
2560 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) 2560 if (linkPart.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2561 { 2561 {
2562 linkPart.PhysActor.link(m_rootPart.PhysActor); 2562 linkPart.PhysActor.link(m_rootPart.PhysActor);
@@ -2578,7 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes
2578 { 2578 {
2579 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++); 2579 LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
2580 // let physics know 2580 // let physics know
2581 part.UpdatePrimFlags(grpusephys, grptemporary, IsPhantom || ((part.Flags & PrimFlags.Phantom) != null), part.VolumeDetectActive, true); 2581 part.UpdatePrimFlags(grpusephys, grptemporary, (IsPhantom || (part.Flags & PrimFlags.Phantom) != 0), part.VolumeDetectActive, true);
2582 if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical) 2582 if (part.PhysActor != null && m_rootPart.PhysActor != null && m_rootPart.PhysActor.IsPhysical)
2583 { 2583 {
2584 part.PhysActor.link(m_rootPart.PhysActor); 2584 part.PhysActor.link(m_rootPart.PhysActor);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f647544..a68b3eb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -295,7 +295,13 @@ namespace OpenSim.Region.Framework.Scenes
295 protected float m_buoyancy = 0.0f; 295 protected float m_buoyancy = 0.0f;
296 protected Vector3 m_force; 296 protected Vector3 m_force;
297 protected Vector3 m_torque; 297 protected Vector3 m_torque;
298 298
299 protected byte m_physicsShapeType = (byte)PhysShapeType.prim;
300 protected float m_density = 1000.0f; // in kg/m^3
301 protected float m_gravitymod = 1.0f;
302 protected float m_friction = 0.6f; // wood
303 protected float m_bounce = 0.5f; // wood
304
299 /// <summary> 305 /// <summary>
300 /// Stores media texture data 306 /// Stores media texture data
301 /// </summary> 307 /// </summary>
@@ -556,19 +562,6 @@ namespace OpenSim.Region.Framework.Scenes
556 } 562 }
557 } 563 }
558 564
559 public byte Material
560 {
561 get { return (byte) m_material; }
562 set
563 {
564 m_material = (Material)value;
565 if (PhysActor != null)
566 {
567 PhysActor.SetMaterial((int)value);
568 }
569 }
570 }
571
572 public bool PassTouches 565 public bool PassTouches
573 { 566 {
574 get { return m_passTouches; } 567 get { return m_passTouches; }
@@ -1377,6 +1370,87 @@ namespace OpenSim.Region.Framework.Scenes
1377 } 1370 }
1378 } 1371 }
1379 1372
1373 public byte Material
1374 {
1375 get { return (byte)m_material; }
1376 set
1377 {
1378 if (value >= 0 && value <= (byte)SOPMaterialData.MaxMaterial)
1379 {
1380 m_material = (Material)value;
1381 m_friction = SOPMaterialData.friction(m_material);
1382 m_bounce = SOPMaterialData.bounce(m_material);
1383 if (PhysActor != null)
1384 {
1385 PhysActor.SetMaterial((int)value);
1386 }
1387 }
1388 }
1389 }
1390
1391 public byte PhysicsShapeType
1392 {
1393 get { return m_physicsShapeType; }
1394 set
1395 {
1396 if (value < 0 || value >= (byte)PhysShapeType.convex)
1397 value = (byte)PhysShapeType.prim; //convex not supported ?
1398
1399 else if (value == (byte)PhysShapeType.none)
1400 {
1401 if (ParentGroup == null || ParentGroup.RootPart == this)
1402 value = (byte)PhysShapeType.prim;
1403 }
1404 m_physicsShapeType = value;
1405 }
1406 }
1407
1408 public float Density // in kg/m^3
1409 {
1410 get { return m_density; }
1411 set
1412 {
1413 if (value >=1 && value <= 22587.0)
1414 {
1415 m_density = value;
1416 }
1417 }
1418 }
1419
1420 public float GravityModifier
1421 {
1422 get { return m_gravitymod; }
1423 set
1424 { if( value >= -1 && value <=28.0f)
1425 m_gravitymod = value;
1426 }
1427 }
1428
1429 public float Friction
1430 {
1431 get { return m_friction; }
1432 set
1433 {
1434 if (value >= 0 && value <= 255.0f)
1435 {
1436 m_friction = value;
1437 }
1438 }
1439 }
1440
1441 public float Bounciness
1442 {
1443 get { return m_bounce; }
1444 set
1445 {
1446 if (value >= 0 && value <= 1.0f)
1447 {
1448 m_bounce = value;
1449 }
1450 }
1451 }
1452
1453
1380 #endregion Public Properties with only Get 1454 #endregion Public Properties with only Get
1381 1455
1382 private uint ApplyMask(uint val, bool set, uint mask) 1456 private uint ApplyMask(uint val, bool set, uint mask)
@@ -1583,9 +1657,13 @@ namespace OpenSim.Region.Framework.Scenes
1583 if (!ParentGroup.Scene.CollidablePrims) 1657 if (!ParentGroup.Scene.CollidablePrims)
1584 return; 1658 return;
1585 1659
1660 if (PhysicsShapeType == (byte)PhysShapeType.none)
1661 return;
1662
1586 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0; 1663 bool isPhysical = (rootObjectFlags & (uint) PrimFlags.Physics) != 0;
1587 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0; 1664 bool isPhantom = (rootObjectFlags & (uint) PrimFlags.Phantom) != 0;
1588 1665
1666
1589 if (IsJoint()) 1667 if (IsJoint())
1590 { 1668 {
1591 DoPhysicsPropertyUpdate(isPhysical, true); 1669 DoPhysicsPropertyUpdate(isPhysical, true);
@@ -1942,6 +2020,7 @@ namespace OpenSim.Region.Framework.Scenes
1942 if (PhysActor.Phantom != phan) 2020 if (PhysActor.Phantom != phan)
1943 PhysActor.Phantom = phan; 2021 PhysActor.Phantom = phan;
1944 2022
2023
1945 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the 2024 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
1946 // mesh data. 2025 // mesh data.
1947 if (Shape.SculptEntry) 2026 if (Shape.SculptEntry)
@@ -4334,6 +4413,41 @@ namespace OpenSim.Region.Framework.Scenes
4334 } 4413 }
4335 } 4414 }
4336 4415
4416
4417 public void UpdateExtraPhysics(ExtraPhysicsData physdata)
4418 {
4419 if (physdata.PhysShapeType == PhysShapeType.invalid || ParentGroup == null)
4420 return;
4421
4422 if (PhysicsShapeType != (byte)physdata.PhysShapeType)
4423 {
4424 PhysicsShapeType = (byte)physdata.PhysShapeType;
4425
4426 if (PhysicsShapeType == (byte)PhysShapeType.none)
4427 {
4428 if (PhysActor != null)
4429 {
4430 Velocity = new Vector3(0, 0, 0);
4431 Acceleration = new Vector3(0, 0, 0);
4432 if (ParentGroup.RootPart == this)
4433 AngularVelocity = new Vector3(0, 0, 0);
4434 ParentGroup.Scene.RemovePhysicalPrim(1);
4435 RemoveFromPhysics();
4436 }
4437 }
4438 else if (PhysActor == null)
4439 ApplyPhysics((uint)Flags, VolumeDetectActive, false);
4440 }
4441
4442 if(Density != physdata.Density)
4443 Density = physdata.Density;
4444 if(GravityModifier != physdata.GravitationModifier)
4445 GravityModifier = physdata.GravitationModifier;
4446 if(Friction != physdata.Friction)
4447 Friction = physdata.Friction;
4448 if(Bounciness != physdata.Bounce)
4449 Bounciness = physdata.Bounce;
4450 }
4337 /// <summary> 4451 /// <summary>
4338 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary. 4452 /// Update the flags on this prim. This covers properties such as phantom, physics and temporary.
4339 /// </summary> 4453 /// </summary>
@@ -4362,9 +4476,10 @@ namespace OpenSim.Region.Framework.Scenes
4362 // ... if VD is changed, all others are not. 4476 // ... if VD is changed, all others are not.
4363 // ... if one of the others is changed, VD is not. 4477 // ... if one of the others is changed, VD is not.
4364 4478
4479/*
4365 if (SetVD) // VD is active, special logic applies 4480 if (SetVD) // VD is active, special logic applies
4366 4481
4367 /* volume detection is now independent of phantom in sl 4482 volume detection is now independent of phantom in sl
4368 4483
4369 { 4484 {
4370 // State machine logic for VolumeDetect 4485 // State machine logic for VolumeDetect
@@ -4385,9 +4500,8 @@ namespace OpenSim.Region.Framework.Scenes
4385 // If volumedetect is active we don't want phantom to be applied. 4500 // If volumedetect is active we don't want phantom to be applied.
4386 // If this is a new call to VD out of the state "phantom" 4501 // If this is a new call to VD out of the state "phantom"
4387 // this will also cause the prim to be visible to physics 4502 // this will also cause the prim to be visible to physics
4388 */
4389 SetPhantom = false; 4503 SetPhantom = false;
4390/* } 4504 }
4391 } 4505 }
4392 else if (wasVD) 4506 else if (wasVD)
4393 { 4507 {
@@ -4434,10 +4548,10 @@ namespace OpenSim.Region.Framework.Scenes
4434 else 4548 else
4435 RemFlag(PrimFlags.Phantom); 4549 RemFlag(PrimFlags.Phantom);
4436 4550
4437 if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment 4551 if ((SetPhantom && !UsePhysics) || ParentGroup.IsAttachment || PhysicsShapeType == (byte)PhysShapeType.none
4438 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints 4552 || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints
4439 { 4553 {
4440 AddFlag(PrimFlags.Phantom); 4554// AddFlag(PrimFlags.Phantom);
4441 4555
4442 Velocity = new Vector3(0, 0, 0); 4556 Velocity = new Vector3(0, 0, 0);
4443 Acceleration = new Vector3(0, 0, 0); 4557 Acceleration = new Vector3(0, 0, 0);
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 51a3320..dfa24e5 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -359,9 +359,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
359 m_SOPXmlProcessors.Add("Torque", ProcessTorque); 359 m_SOPXmlProcessors.Add("Torque", ProcessTorque);
360 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive); 360 m_SOPXmlProcessors.Add("VolumeDetectActive", ProcessVolumeDetectActive);
361 361
362 //Ubit comented until proper testing
363 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
364 362
363 m_SOPXmlProcessors.Add("Vehicle", ProcessVehicle);
364
365 m_SOPXmlProcessors.Add("PhysicsShapeType", ProcessPhysicsShapeType);
366 m_SOPXmlProcessors.Add("Density", ProcessDensity);
367 m_SOPXmlProcessors.Add("Friction", ProcessFriction);
368 m_SOPXmlProcessors.Add("Bounce", ProcessBounce);
369 m_SOPXmlProcessors.Add("GravityModifier", ProcessGravityModifier);
365 370
366 #endregion 371 #endregion
367 372
@@ -390,7 +395,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
390 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask); 395 m_TaskInventoryXmlProcessors.Add("PermsMask", ProcessTIPermsMask);
391 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType); 396 m_TaskInventoryXmlProcessors.Add("Type", ProcessTIType);
392 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged); 397 m_TaskInventoryXmlProcessors.Add("OwnerChanged", ProcessTIOwnerChanged);
393 398
394 #endregion 399 #endregion
395 400
396 #region ShapeXmlProcessors initialization 401 #region ShapeXmlProcessors initialization
@@ -585,6 +590,31 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
585 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty); 590 obj.ClickAction = (byte)reader.ReadElementContentAsInt("ClickAction", String.Empty);
586 } 591 }
587 592
593 private static void ProcessPhysicsShapeType(SceneObjectPart obj, XmlTextReader reader)
594 {
595 obj.PhysicsShapeType = (byte)reader.ReadElementContentAsInt("PhysicsShapeType", String.Empty);
596 }
597
598 private static void ProcessDensity(SceneObjectPart obj, XmlTextReader reader)
599 {
600 obj.Density = (byte)reader.ReadElementContentAsInt("Density", String.Empty);
601 }
602
603 private static void ProcessFriction(SceneObjectPart obj, XmlTextReader reader)
604 {
605 obj.Friction = (byte)reader.ReadElementContentAsInt("Friction", String.Empty);
606 }
607
608 private static void ProcessBounce(SceneObjectPart obj, XmlTextReader reader)
609 {
610 obj.Bounciness = (byte)reader.ReadElementContentAsInt("Bounce", String.Empty);
611 }
612
613 private static void ProcessGravityModifier(SceneObjectPart obj, XmlTextReader reader)
614 {
615 obj.GravityModifier = (byte)reader.ReadElementContentAsInt("GravityModifier", String.Empty);
616 }
617
588 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader) 618 private static void ProcessVehicle(SceneObjectPart obj, XmlTextReader reader)
589 { 619 {
590 bool errors = false; 620 bool errors = false;
@@ -1288,9 +1318,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1288 1318
1289 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower()); 1319 writer.WriteElementString("VolumeDetectActive", sop.VolumeDetectActive.ToString().ToLower());
1290 1320
1291 //Ubit comented until proper testing 1321 if (sop.sopVehicle != null)
1292 if (sop.sopVehicle != null) 1322 sop.sopVehicle.ToXml2(writer);
1293 sop.sopVehicle.ToXml2(writer); 1323
1324 if(sop.PhysicsShapeType != (byte)PhysShapeType.prim)
1325 writer.WriteElementString("PhysicsShapeType", sop.PhysicsShapeType.ToString().ToLower());
1326 if (sop.Density != 1000.0f)
1327 writer.WriteElementString("Density", sop.Density.ToString().ToLower());
1328 if (sop.Friction != 0.6f)
1329 writer.WriteElementString("Friction", sop.Friction.ToString().ToLower());
1330 if (sop.Bounciness != 0.5f)
1331 writer.WriteElementString("Bounce", sop.Bounciness.ToString().ToLower());
1332 if (sop.GravityModifier != 1.0f)
1333 writer.WriteElementString("GravityModifier", sop.GravityModifier.ToString().ToLower());
1294 1334
1295 writer.WriteEndElement(); 1335 writer.WriteEndElement();
1296 } 1336 }