diff options
author | Melanie | 2012-05-27 19:35:36 +0100 |
---|---|---|
committer | Melanie | 2012-05-27 19:35:36 +0100 |
commit | 78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63 (patch) | |
tree | f89d40cb907cd6d8a0df0432c089633c1eb50b8b /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'ubitwork' into avination (diff) | |
download | opensim-SC-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.zip opensim-SC-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.gz opensim-SC-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.bz2 opensim-SC-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.xz |
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 334 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 108 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 133 |
4 files changed, 386 insertions, 191 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index 5d43027..81ca9f1 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |||
@@ -33,67 +33,116 @@ using OpenSim.Framework; | |||
33 | 33 | ||
34 | namespace OpenSim.Region.Framework.Scenes | 34 | namespace OpenSim.Region.Framework.Scenes |
35 | { | 35 | { |
36 | public static class CollisionSounds | 36 | public struct CollisionForSoundInfo |
37 | { | 37 | { |
38 | // defines for cases | 38 | public uint colliderID; |
39 | // only know one UUID for now (woodflesh) | 39 | public Vector3 position; |
40 | public float relativeVel; | ||
41 | } | ||
40 | 42 | ||
43 | public static class CollisionSounds | ||
44 | { | ||
41 | private const int MaxMaterials = 7; | 45 | private const int MaxMaterials = 7; |
42 | // part part | 46 | // part part |
47 | /* | ||
48 | private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66"); | ||
49 | private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66"); | ||
50 | private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66"); | ||
51 | private static UUID snd_StoneWood = new UUID("be7295c0-a158-11e1-b3dd-0800203c9a66"); | ||
52 | private static UUID snd_StoneFlesh = new UUID("be7295c0-a158-11e1-b3dd-0800204c9a66"); | ||
53 | private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66"); | ||
54 | private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66"); | ||
55 | |||
56 | private static UUID snd_MetalStone = new UUID("be7295c0-a158-11e1-b3dd-0801200c9a66"); | ||
57 | private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66"); | ||
58 | private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66"); | ||
59 | private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66"); | ||
60 | private static UUID snd_MetalFlesh = new UUID("be7295c0-a158-11e1-b3dd-0801204c9a66"); | ||
61 | private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66"); | ||
62 | private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66"); | ||
63 | |||
64 | private static UUID snd_GlassStone = new UUID("be7295c0-a158-11e1-b3dd-0802200c9a66"); | ||
65 | private static UUID snd_GlassMetal = new UUID("be7295c0-a158-11e1-b3dd-0802201c9a66"); | ||
66 | private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66"); | ||
67 | private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66"); | ||
68 | private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66"); | ||
69 | private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66"); | ||
70 | private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66"); | ||
71 | |||
72 | private static UUID snd_WoodStone = new UUID("be7295c0-a158-11e1-b3dd-0803200c9a66"); | ||
73 | private static UUID snd_WoodMetal = new UUID("be7295c0-a158-11e1-b3dd-0803201c9a66"); | ||
74 | private static UUID snd_WoodGlass = new UUID("be7295c0-a158-11e1-b3dd-0803202c9a66"); | ||
75 | private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66"); | ||
76 | private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66"); | ||
77 | private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66"); | ||
78 | private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66"); | ||
79 | |||
80 | private static UUID snd_FleshStone = new UUID("be7295c0-a158-11e1-b3dd-0804200c9a66"); | ||
81 | private static UUID snd_FleshMetal = new UUID("be7295c0-a158-11e1-b3dd-0804201c9a66"); | ||
82 | private static UUID snd_FleshGlass = new UUID("be7295c0-a158-11e1-b3dd-0804202c9a66"); | ||
83 | private static UUID snd_FleshWood = new UUID("be7295c0-a158-11e1-b3dd-0804203c9a66"); | ||
84 | private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66"); | ||
85 | private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66"); | ||
86 | private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66"); | ||
87 | |||
88 | private static UUID snd_PlasticStone = new UUID("be7295c0-a158-11e1-b3dd-0805200c9a66"); | ||
89 | private static UUID snd_PlasticMetal = new UUID("be7295c0-a158-11e1-b3dd-0805201c9a66"); | ||
90 | private static UUID snd_PlasticGlass = new UUID("be7295c0-a158-11e1-b3dd-0805202c9a66"); | ||
91 | private static UUID snd_PlasticWood = new UUID("be7295c0-a158-11e1-b3dd-0805203c9a66"); | ||
92 | private static UUID snd_PlasticFlesh = new UUID("be7295c0-a158-11e1-b3dd-0805204c9a66"); | ||
93 | private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66"); | ||
94 | private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66"); | ||
95 | |||
96 | private static UUID snd_RubberStone = new UUID("be7295c0-a158-11e1-b3dd-0806200c9a66"); | ||
97 | private static UUID snd_RubberMetal = new UUID("be7295c0-a158-11e1-b3dd-0806201c9a66"); | ||
98 | private static UUID snd_RubberGlass = new UUID("be7295c0-a158-11e1-b3dd-0806202c9a66"); | ||
99 | private static UUID snd_RubberWood = new UUID("be7295c0-a158-11e1-b3dd-0806203c9a66"); | ||
100 | private static UUID snd_RubberFlesh = new UUID("be7295c0-a158-11e1-b3dd-0806204c9a66"); | ||
101 | private static UUID snd_RubberPlastic = new UUID("be7295c0-a158-11e1-b3dd-0806205c9a66"); | ||
102 | private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66"); | ||
103 | |||
104 | // terrain part | ||
105 | private static UUID snd_TerrainStone = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
106 | private static UUID snd_TerrainMetal = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
107 | private static UUID snd_TerrainGlass = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
108 | private static UUID snd_TerrainWood = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
109 | private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
110 | private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
111 | private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); | ||
112 | */ | ||
43 | private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 113 | private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
44 | private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 114 | private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
45 | private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 115 | private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
46 | private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 116 | private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
47 | private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 117 | private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
48 | private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 118 | private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
49 | private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 119 | private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
50 | 120 | ||
51 | private static UUID snd_MetalStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 121 | private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
52 | private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 122 | private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
53 | private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 123 | private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
54 | private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 124 | private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
55 | private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 125 | private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
56 | private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 126 | private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
57 | private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 127 | |
58 | 128 | private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | |
59 | private static UUID snd_GlassStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 129 | private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
60 | private static UUID snd_GlassMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 130 | private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
61 | private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 131 | private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
62 | private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 132 | private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
63 | private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 133 | |
64 | private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 134 | private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
65 | private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 135 | private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
66 | 136 | private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | |
67 | private static UUID snd_WoodStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 137 | private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
68 | private static UUID snd_WoodMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 138 | |
69 | private static UUID snd_WoodGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 139 | private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
70 | private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 140 | private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
71 | private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 141 | private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
72 | private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 142 | |
73 | private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 143 | private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
74 | 144 | private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | |
75 | private static UUID snd_FleshStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 145 | |
76 | private static UUID snd_FleshMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
77 | private static UUID snd_FleshGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
78 | private static UUID snd_FleshWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
79 | private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
80 | private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
81 | private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
82 | |||
83 | private static UUID snd_PlasticStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
84 | private static UUID snd_PlasticMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
85 | private static UUID snd_PlasticGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
86 | private static UUID snd_PlasticWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
87 | private static UUID snd_PlasticFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
88 | private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
89 | private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
90 | |||
91 | private static UUID snd_RubberStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
92 | private static UUID snd_RubberMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
93 | private static UUID snd_RubberGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
94 | private static UUID snd_RubberWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
95 | private static UUID snd_RubberFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
96 | private static UUID snd_RubberPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | ||
97 | private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); | 146 | private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a"); |
98 | 147 | ||
99 | // terrain part | 148 | // terrain part |
@@ -114,7 +163,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
114 | snd_TerrainPlastic, | 163 | snd_TerrainPlastic, |
115 | snd_TerrainRubber | 164 | snd_TerrainRubber |
116 | }; | 165 | }; |
117 | 166 | /* | |
167 | //full assimetric sounds | ||
118 | public static UUID[] m_PartPart = { | 168 | public static UUID[] m_PartPart = { |
119 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, | 169 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, |
120 | snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, | 170 | snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, |
@@ -124,10 +174,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
124 | snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber, | 174 | snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber, |
125 | snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber | 175 | snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber |
126 | }; | 176 | }; |
127 | 177 | */ | |
128 | public static void PartCollisionSound(SceneObjectPart part,List<uint> Colliders) | 178 | // simetric sounds |
179 | public static UUID[] m_PartPart = { | ||
180 | snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, | ||
181 | snd_StoneMetal, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber, | ||
182 | snd_StoneGlass, snd_MetalGlass, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber, | ||
183 | snd_StoneWood, snd_MetalWood, snd_GlassWood, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber, | ||
184 | snd_StoneFlesh, snd_MetalFlesh, snd_GlassFlesh, snd_WoodFlesh, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber, | ||
185 | snd_StonePlastic, snd_MetalPlastic, snd_GlassPlastic, snd_WoodPlastic, snd_FleshPlastic, snd_PlasticPlastic, snd_PlasticRubber, | ||
186 | snd_StoneRubber, snd_MetalRubber, snd_GlassRubber, snd_WoodRubber, snd_FleshRubber, snd_PlasticRubber, snd_RubberRubber | ||
187 | }; | ||
188 | |||
189 | public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist) | ||
129 | { | 190 | { |
130 | if(Colliders.Count == 0 || part == null) | 191 | if (collidersinfolist.Count == 0 || part == null) |
131 | return; | 192 | return; |
132 | 193 | ||
133 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) | 194 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) |
@@ -136,121 +197,161 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | if (part.ParentGroup == null) | 197 | if (part.ParentGroup == null) |
137 | return; | 198 | return; |
138 | 199 | ||
139 | if (part.CollisionSound == part.invalidCollisionSoundUUID) | 200 | if (part.CollisionSoundType < 0) |
140 | return; | 201 | return; |
141 | 202 | ||
142 | UUID soundID; | 203 | float volume = 0.0f; |
143 | int otherMaterial; | 204 | bool HaveSound = false; |
144 | 205 | ||
145 | Vector3 position = part.AbsolutePosition; | 206 | UUID soundID = part.CollisionSound; |
146 | 207 | ||
147 | if (part.CollisionSound != UUID.Zero) | 208 | if (part.CollisionSoundType > 0) |
148 | { | 209 | { |
149 | if (part.CollisionSoundVolume > 0.0f) | 210 | // soundID = part.CollisionSound; |
150 | part.SendCollisionSound(part.CollisionSound, part.CollisionSoundVolume, position); | 211 | volume = part.CollisionSoundVolume; |
151 | return; | 212 | if (volume == 0.0f) |
213 | return; | ||
214 | HaveSound = true; | ||
152 | } | 215 | } |
153 | 216 | ||
154 | int thisMaterial = (int) part.Material; | 217 | bool doneownsound = false; |
218 | |||
219 | int thisMaterial = (int)part.Material; | ||
155 | if (thisMaterial >= MaxMaterials) | 220 | if (thisMaterial >= MaxMaterials) |
156 | thisMaterial = 3; | 221 | thisMaterial = 3; |
157 | |||
158 | int thisMatScaled = thisMaterial * MaxMaterials; | 222 | int thisMatScaled = thisMaterial * MaxMaterials; |
159 | int index; | ||
160 | 223 | ||
161 | bool doneownsound = false; | 224 | CollisionForSoundInfo colInfo; |
225 | uint id; | ||
162 | 226 | ||
163 | foreach (uint Id in Colliders) | 227 | for(int i = 0; i< collidersinfolist.Count; i++) |
164 | { | 228 | { |
165 | if (Id == 0) | 229 | colInfo = collidersinfolist[i]; |
230 | |||
231 | id = colInfo.colliderID; | ||
232 | if (id == 0) // terrain collision | ||
166 | { | 233 | { |
167 | if (!doneownsound) | 234 | if (!doneownsound) |
168 | { | 235 | { |
169 | soundID = m_TerrainPart[thisMaterial]; | 236 | if (!HaveSound) |
170 | part.SendCollisionSound(soundID, 1.0, position); | 237 | { |
238 | volume = Math.Abs(colInfo.relativeVel); | ||
239 | if (volume < 0.2f) | ||
240 | continue; | ||
241 | |||
242 | volume *= volume * .0625f; // 4m/s == full volume | ||
243 | if (volume > 1.0f) | ||
244 | volume = 1.0f; | ||
245 | |||
246 | soundID = m_TerrainPart[thisMaterial]; | ||
247 | } | ||
248 | part.SendCollisionSound(soundID, volume, colInfo.position); | ||
171 | doneownsound = true; | 249 | doneownsound = true; |
172 | } | 250 | } |
173 | continue; | 251 | continue; |
174 | } | 252 | } |
175 | 253 | ||
176 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(Id); | 254 | SceneObjectPart otherPart = part.ParentGroup.Scene.GetSceneObjectPart(id); |
177 | if (otherPart != null) | 255 | if (otherPart != null) |
178 | { | 256 | { |
179 | if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) | 257 | if (otherPart.CollisionSoundType < 0 || otherPart.VolumeDetectActive) |
180 | continue; | 258 | continue; |
181 | if (otherPart.CollisionSound != UUID.Zero) | 259 | |
182 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); | 260 | if (!HaveSound) |
183 | else | ||
184 | { | 261 | { |
185 | otherMaterial = (int)otherPart.Material; | 262 | if (otherPart.CollisionSoundType > 0) |
186 | if (otherMaterial >= MaxMaterials) | 263 | { |
187 | otherMaterial = 3; | 264 | soundID = otherPart.CollisionSound; |
188 | index = thisMatScaled + otherMaterial; | 265 | volume = otherPart.CollisionSoundVolume; |
189 | soundID = m_PartPart[index]; | 266 | if (volume == 0.0f) |
190 | if (doneownsound) | 267 | continue; |
191 | otherPart.SendCollisionSound(soundID, 1.0, position); | 268 | } |
192 | else | 269 | else |
193 | { | 270 | { |
194 | part.SendCollisionSound(soundID, 1.0, position); | 271 | volume = Math.Abs(colInfo.relativeVel); |
195 | doneownsound = true; | 272 | if (volume < 0.2f) |
273 | continue; | ||
274 | |||
275 | volume *= volume * .0625f; // 4m/s == full volume | ||
276 | if (volume > 1.0f) | ||
277 | volume = 1.0f; | ||
278 | |||
279 | int otherMaterial = (int)otherPart.Material; | ||
280 | if (otherMaterial >= MaxMaterials) | ||
281 | otherMaterial = 3; | ||
282 | |||
283 | soundID = m_PartPart[thisMatScaled + otherMaterial]; | ||
196 | } | 284 | } |
197 | } | 285 | } |
198 | } | 286 | |
199 | /* avatars get notification let them trigger the sound | 287 | if (doneownsound) |
200 | else if (!doneownsound) | 288 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); |
201 | { | 289 | else |
202 | ScenePresence av = part.ParentGroup.Scene.GetScenePresence(Id); | ||
203 | if (av != null && (!av.IsChildAgent)) | ||
204 | { | 290 | { |
205 | index = thisMatScaled + 4; // flesh | 291 | part.SendCollisionSound(soundID, volume, colInfo.position); |
206 | soundID = m_PartPart[index]; | ||
207 | part.SendCollisionSound(soundID, 1.0); | ||
208 | doneownsound = true; | 292 | doneownsound = true; |
209 | } | 293 | } |
210 | } | 294 | } |
211 | */ | ||
212 | } | 295 | } |
213 | } | 296 | } |
214 | 297 | ||
215 | public static void AvatarCollisionSound(ScenePresence av, List<uint> Colliders) | 298 | public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist) |
216 | { | 299 | { |
217 | if (Colliders.Count == 0 || av == null) | 300 | if (collidersinfolist.Count == 0 || av == null) |
218 | return; | 301 | return; |
219 | 302 | ||
220 | UUID soundID; | 303 | UUID soundID; |
221 | int otherMaterial; | 304 | int otherMaterial; |
222 | 305 | ||
223 | int thisMaterial = 3; | 306 | int thisMaterial = 4; // flesh |
224 | 307 | ||
225 | int thisMatScaled = thisMaterial * MaxMaterials; | 308 | int thisMatScaled = thisMaterial * MaxMaterials; |
226 | int index; | ||
227 | // bool doneownsound = false; | ||
228 | 309 | ||
229 | Vector3 position = av.AbsolutePosition; | 310 | // bool doneownsound = false; |
230 | 311 | ||
231 | foreach (uint Id in Colliders) | 312 | CollisionForSoundInfo colInfo; |
313 | uint id; | ||
314 | float volume; | ||
315 | |||
316 | for(int i = 0; i< collidersinfolist.Count; i++) | ||
232 | { | 317 | { |
233 | if (Id == 0) | 318 | colInfo = collidersinfolist[i]; |
319 | |||
320 | id = colInfo.colliderID; | ||
321 | |||
322 | if (id == 0) // no terrain collision sounds for now | ||
234 | { | 323 | { |
235 | continue; | 324 | continue; |
325 | // volume = Math.Abs(colInfo.relativeVel); | ||
326 | // if (volume < 0.2f) | ||
327 | // continue; | ||
328 | |||
236 | } | 329 | } |
237 | 330 | ||
238 | SceneObjectPart otherPart = av.Scene.GetSceneObjectPart(Id); | 331 | SceneObjectPart otherPart = av.Scene.GetSceneObjectPart(id); |
239 | if (otherPart != null) | 332 | if (otherPart != null) |
240 | { | 333 | { |
241 | if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) | 334 | if (otherPart.CollisionSoundType < 0) |
242 | continue; | 335 | continue; |
243 | if (otherPart.CollisionSound != UUID.Zero) | 336 | if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) |
244 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); | 337 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); |
245 | else | 338 | else |
246 | { | 339 | { |
340 | volume = Math.Abs(colInfo.relativeVel); | ||
341 | if (volume < 0.2f) | ||
342 | continue; | ||
343 | |||
344 | volume *= volume * .0625f; // 4m/s == full volume | ||
345 | if (volume > 1.0f) | ||
346 | volume = 1.0f; | ||
247 | otherMaterial = (int)otherPart.Material; | 347 | otherMaterial = (int)otherPart.Material; |
248 | if (otherMaterial >= MaxMaterials) | 348 | if (otherMaterial >= MaxMaterials) |
249 | otherMaterial = 3; | 349 | otherMaterial = 3; |
250 | index = thisMatScaled + otherMaterial; | 350 | |
251 | soundID = m_PartPart[index]; | 351 | soundID = m_PartPart[thisMatScaled + otherMaterial]; |
252 | otherPart.SendCollisionSound(soundID, 1.0, position); | 352 | otherPart.SendCollisionSound(soundID, volume, colInfo.position); |
253 | } | 353 | } |
354 | continue; | ||
254 | } | 355 | } |
255 | /* | 356 | /* |
256 | else if (!doneownsound) | 357 | else if (!doneownsound) |
@@ -266,6 +367,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | */ | 367 | */ |
267 | } | 368 | } |
268 | } | 369 | } |
269 | |||
270 | } | 370 | } |
271 | } \ No newline at end of file | 371 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5328ddc..46a7e3d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3763,7 +3763,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3763 | } | 3763 | } |
3764 | if ((change & ObjectChangeType.Position) != 0) | 3764 | if ((change & ObjectChangeType.Position) != 0) |
3765 | { | 3765 | { |
3766 | if (m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) | 3766 | if (IsAttachment || m_scene.Permissions.CanObjectEntry(group.UUID, false, data.position)) |
3767 | UpdateGroupPosition(data.position); | 3767 | UpdateGroupPosition(data.position); |
3768 | updateType = updatetype.groupterse; | 3768 | updateType = updatetype.groupterse; |
3769 | } | 3769 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 221a32b..749b281 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -329,11 +329,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
329 | private Vector3 m_cameraAtOffset; | 329 | private Vector3 m_cameraAtOffset; |
330 | private bool m_forceMouselook; | 330 | private bool m_forceMouselook; |
331 | 331 | ||
332 | // TODO: Collision sound should have default. | 332 | |
333 | // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound | ||
334 | private sbyte m_collisionSoundType; | ||
333 | private UUID m_collisionSound; | 335 | private UUID m_collisionSound; |
334 | private float m_collisionSoundVolume; | 336 | private float m_collisionSoundVolume; |
335 | 337 | ||
336 | private DateTime LastColSoundSentTime; | 338 | private int LastColSoundSentTime; |
337 | 339 | ||
338 | 340 | ||
339 | private SOPVehicle m_vehicle = null; | 341 | private SOPVehicle m_vehicle = null; |
@@ -374,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
374 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 376 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
375 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 377 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
376 | m_inventory = new SceneObjectPartInventory(this); | 378 | m_inventory = new SceneObjectPartInventory(this); |
377 | LastColSoundSentTime = DateTime.UtcNow; | 379 | LastColSoundSentTime = Util.EnvironmentTickCount(); |
378 | } | 380 | } |
379 | 381 | ||
380 | /// <summary> | 382 | /// <summary> |
@@ -1353,12 +1355,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
1353 | 1355 | ||
1354 | public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); | 1356 | public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); |
1355 | 1357 | ||
1358 | // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound | ||
1359 | // runtime thing.. do not persist | ||
1360 | [XmlIgnore] | ||
1361 | public sbyte CollisionSoundType | ||
1362 | { | ||
1363 | get | ||
1364 | { | ||
1365 | return m_collisionSoundType; | ||
1366 | } | ||
1367 | set | ||
1368 | { | ||
1369 | m_collisionSoundType = value; | ||
1370 | if (value == -1) | ||
1371 | m_collisionSound = invalidCollisionSoundUUID; | ||
1372 | else if (value == 0) | ||
1373 | m_collisionSound = UUID.Zero; | ||
1374 | } | ||
1375 | } | ||
1376 | |||
1356 | public UUID CollisionSound | 1377 | public UUID CollisionSound |
1357 | { | 1378 | { |
1358 | get { return m_collisionSound; } | 1379 | get { return m_collisionSound; } |
1359 | set | 1380 | set |
1360 | { | 1381 | { |
1361 | m_collisionSound = value; | 1382 | m_collisionSound = value; |
1383 | |||
1384 | if (value == invalidCollisionSoundUUID) | ||
1385 | m_collisionSoundType = -1; | ||
1386 | else if (value == UUID.Zero) | ||
1387 | m_collisionSoundType = 0; | ||
1388 | else | ||
1389 | m_collisionSoundType = 1; | ||
1390 | |||
1362 | aggregateScriptEvents(); | 1391 | aggregateScriptEvents(); |
1363 | } | 1392 | } |
1364 | } | 1393 | } |
@@ -1586,7 +1615,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1586 | } | 1615 | } |
1587 | } | 1616 | } |
1588 | else if (PhysActor == null) | 1617 | else if (PhysActor == null) |
1618 | { | ||
1589 | ApplyPhysics((uint)Flags, VolumeDetectActive, false); | 1619 | ApplyPhysics((uint)Flags, VolumeDetectActive, false); |
1620 | UpdatePhysicsSubscribedEvents(); | ||
1621 | } | ||
1590 | else | 1622 | else |
1591 | { | 1623 | { |
1592 | PhysActor.PhysicsShapeType = m_physicsShapeType; | 1624 | PhysActor.PhysicsShapeType = m_physicsShapeType; |
@@ -2646,13 +2678,42 @@ namespace OpenSim.Region.Framework.Scenes | |||
2646 | 2678 | ||
2647 | else | 2679 | else |
2648 | { | 2680 | { |
2681 | List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); | ||
2682 | |||
2649 | // calculate things that started colliding this time | 2683 | // calculate things that started colliding this time |
2650 | // and build up list of colliders this time | 2684 | // and build up list of colliders this time |
2651 | foreach (uint localid in collissionswith.Keys) | 2685 | if (!VolumeDetectActive && CollisionSoundType >= 0) |
2686 | { | ||
2687 | CollisionForSoundInfo soundinfo; | ||
2688 | ContactPoint curcontact; | ||
2689 | |||
2690 | foreach (uint id in collissionswith.Keys) | ||
2691 | { | ||
2692 | thisHitColliders.Add(id); | ||
2693 | if (!m_lastColliders.Contains(id)) | ||
2694 | { | ||
2695 | startedColliders.Add(id); | ||
2696 | |||
2697 | curcontact = collissionswith[id]; | ||
2698 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | ||
2699 | { | ||
2700 | soundinfo = new CollisionForSoundInfo(); | ||
2701 | soundinfo.colliderID = id; | ||
2702 | soundinfo.position = curcontact.Position; | ||
2703 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
2704 | soundinfolist.Add(soundinfo); | ||
2705 | } | ||
2706 | } | ||
2707 | } | ||
2708 | } | ||
2709 | else | ||
2652 | { | 2710 | { |
2653 | thisHitColliders.Add(localid); | 2711 | foreach (uint id in collissionswith.Keys) |
2654 | if (!m_lastColliders.Contains(localid)) | 2712 | { |
2655 | startedColliders.Add(localid); | 2713 | thisHitColliders.Add(id); |
2714 | if (!m_lastColliders.Contains(id)) | ||
2715 | startedColliders.Add(id); | ||
2716 | } | ||
2656 | } | 2717 | } |
2657 | 2718 | ||
2658 | // calculate things that ended colliding | 2719 | // calculate things that ended colliding |
@@ -2669,17 +2730,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2669 | // remove things that ended colliding from the last colliders list | 2730 | // remove things that ended colliding from the last colliders list |
2670 | foreach (uint localID in endedColliders) | 2731 | foreach (uint localID in endedColliders) |
2671 | m_lastColliders.Remove(localID); | 2732 | m_lastColliders.Remove(localID); |
2672 | } | ||
2673 | |||
2674 | // play the sound. | ||
2675 | 2733 | ||
2676 | bool IsNotVolumeDtc = !VolumeDetectActive; | 2734 | // play sounds. |
2677 | 2735 | if (soundinfolist.Count > 0) | |
2678 | if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) | 2736 | CollisionSounds.PartCollisionSound(this, soundinfolist); |
2679 | CollisionSounds.PartCollisionSound(this, startedColliders); | 2737 | } |
2680 | 2738 | ||
2681 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 2739 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); |
2682 | if (IsNotVolumeDtc) | 2740 | if (!VolumeDetectActive) |
2683 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); | 2741 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); |
2684 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); | 2742 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); |
2685 | 2743 | ||
@@ -3224,8 +3282,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3224 | if (volume < 0) | 3282 | if (volume < 0) |
3225 | volume = 0; | 3283 | volume = 0; |
3226 | 3284 | ||
3227 | DateTime now = DateTime.UtcNow; | 3285 | int now = Util.EnvironmentTickCount(); |
3228 | if((now - LastColSoundSentTime).Milliseconds < 200) // reduce rate to 5 per sec per part ?? | 3286 | if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) |
3229 | return; | 3287 | return; |
3230 | 3288 | ||
3231 | LastColSoundSentTime = now; | 3289 | LastColSoundSentTime = now; |
@@ -4623,7 +4681,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
4623 | /// </remarks> | 4681 | /// </remarks> |
4624 | public void RemoveFromPhysics() | 4682 | public void RemoveFromPhysics() |
4625 | { | 4683 | { |
4626 | ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); | 4684 | PhysicsActor pa = PhysActor; |
4685 | if (pa != null) | ||
4686 | { | ||
4687 | pa.OnCollisionUpdate -= PhysicsCollision; | ||
4688 | pa.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; | ||
4689 | pa.OnOutOfBounds -= PhysicsOutOfBounds; | ||
4690 | |||
4691 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); | ||
4692 | } | ||
4627 | PhysActor = null; | 4693 | PhysActor = null; |
4628 | } | 4694 | } |
4629 | 4695 | ||
@@ -4792,7 +4858,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4792 | 4858 | ||
4793 | pa.OnCollisionUpdate -= PhysicsCollision; | 4859 | pa.OnCollisionUpdate -= PhysicsCollision; |
4794 | 4860 | ||
4795 | bool hassound = ( CollisionSound != invalidCollisionSoundUUID); | 4861 | bool hassound = (CollisionSoundType >= 0 && !VolumeDetectActive); |
4862 | |||
4796 | scriptEvents CombinedEvents = AggregateScriptEvents; | 4863 | scriptEvents CombinedEvents = AggregateScriptEvents; |
4797 | 4864 | ||
4798 | // merge with root part | 4865 | // merge with root part |
@@ -4801,10 +4868,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4801 | 4868 | ||
4802 | // submit to this part case | 4869 | // submit to this part case |
4803 | if (VolumeDetectActive) | 4870 | if (VolumeDetectActive) |
4804 | { | ||
4805 | CombinedEvents &= PhyscicsVolumeDtcSubsEvents; | 4871 | CombinedEvents &= PhyscicsVolumeDtcSubsEvents; |
4806 | hassound = false; | ||
4807 | } | ||
4808 | else if ((Flags & PrimFlags.Phantom) != 0) | 4872 | else if ((Flags & PrimFlags.Phantom) != 0) |
4809 | CombinedEvents &= PhyscicsPhantonSubsEvents; | 4873 | CombinedEvents &= PhyscicsPhantonSubsEvents; |
4810 | else | 4874 | else |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e0872d0..225d4c9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2043,7 +2043,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2043 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); | 2043 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); |
2044 | 2044 | ||
2045 | if (PhysicsActor != null) | 2045 | if (PhysicsActor != null) |
2046 | m_sitAvatarHeight = PhysicsActor.Size.Z; | 2046 | m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f; |
2047 | 2047 | ||
2048 | bool canSit = false; | 2048 | bool canSit = false; |
2049 | pos = part.AbsolutePosition + offset; | 2049 | pos = part.AbsolutePosition + offset; |
@@ -4287,6 +4287,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4287 | 4287 | ||
4288 | private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) | 4288 | private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) |
4289 | { | 4289 | { |
4290 | /* | ||
4290 | lock(m_collisionEventLock) | 4291 | lock(m_collisionEventLock) |
4291 | { | 4292 | { |
4292 | if (m_collisionEventFlag) | 4293 | if (m_collisionEventFlag) |
@@ -4296,76 +4297,106 @@ namespace OpenSim.Region.Framework.Scenes | |||
4296 | 4297 | ||
4297 | Util.FireAndForget(delegate(object x) | 4298 | Util.FireAndForget(delegate(object x) |
4298 | { | 4299 | { |
4300 | */ | ||
4299 | try | 4301 | try |
4300 | { | 4302 | { |
4301 | List<uint> thisHitColliders = new List<uint>(); | 4303 | List<uint> thisHitColliders = new List<uint>(); |
4302 | List<uint> endedColliders = new List<uint>(); | 4304 | List<uint> endedColliders = new List<uint>(); |
4303 | List<uint> startedColliders = new List<uint>(); | 4305 | List<uint> startedColliders = new List<uint>(); |
4306 | List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); | ||
4307 | CollisionForSoundInfo soundinfo; | ||
4308 | ContactPoint curcontact; | ||
4304 | 4309 | ||
4305 | foreach (uint localid in coldata.Keys) | 4310 | if (coldata.Count == 0) |
4306 | { | 4311 | { |
4307 | thisHitColliders.Add(localid); | 4312 | if (m_lastColliders.Count == 0) |
4308 | if (!m_lastColliders.Contains(localid)) | 4313 | return; // nothing to do |
4309 | { | 4314 | |
4310 | startedColliders.Add(localid); | 4315 | foreach (uint localID in m_lastColliders) |
4311 | } | ||
4312 | //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
4313 | } | ||
4314 | |||
4315 | // calculate things that ended colliding | ||
4316 | foreach (uint localID in m_lastColliders) | ||
4317 | { | ||
4318 | if (!thisHitColliders.Contains(localID)) | ||
4319 | { | 4316 | { |
4320 | endedColliders.Add(localID); | 4317 | endedColliders.Add(localID); |
4321 | } | 4318 | } |
4322 | } | 4319 | m_lastColliders.Clear(); |
4323 | //add the items that started colliding this time to the last colliders list. | ||
4324 | foreach (uint localID in startedColliders) | ||
4325 | { | ||
4326 | m_lastColliders.Add(localID); | ||
4327 | } | ||
4328 | // remove things that ended colliding from the last colliders list | ||
4329 | foreach (uint localID in endedColliders) | ||
4330 | { | ||
4331 | m_lastColliders.Remove(localID); | ||
4332 | } | 4320 | } |
4333 | 4321 | ||
4334 | // do event notification | 4322 | else |
4335 | if (startedColliders.Count > 0) | ||
4336 | { | 4323 | { |
4337 | CollisionSounds.AvatarCollisionSound(this, startedColliders); | 4324 | foreach (uint id in coldata.Keys) |
4338 | |||
4339 | ColliderArgs StartCollidingMessage = new ColliderArgs(); | ||
4340 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
4341 | foreach (uint localId in startedColliders) | ||
4342 | { | 4325 | { |
4343 | if (localId == 0) | 4326 | thisHitColliders.Add(id); |
4344 | continue; | 4327 | if (!m_lastColliders.Contains(id)) |
4328 | { | ||
4329 | startedColliders.Add(id); | ||
4330 | curcontact = coldata[id]; | ||
4331 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | ||
4332 | { | ||
4333 | soundinfo = new CollisionForSoundInfo(); | ||
4334 | soundinfo.colliderID = id; | ||
4335 | soundinfo.position = curcontact.Position; | ||
4336 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
4337 | soundinfolist.Add(soundinfo); | ||
4338 | } | ||
4339 | } | ||
4340 | //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
4341 | } | ||
4345 | 4342 | ||
4346 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | 4343 | // calculate things that ended colliding |
4347 | string data = ""; | 4344 | foreach (uint localID in m_lastColliders) |
4348 | if (obj != null) | 4345 | { |
4346 | if (!thisHitColliders.Contains(localID)) | ||
4349 | { | 4347 | { |
4350 | DetectedObject detobj = new DetectedObject(); | 4348 | endedColliders.Add(localID); |
4351 | detobj.keyUUID = obj.UUID; | ||
4352 | detobj.nameStr = obj.Name; | ||
4353 | detobj.ownerUUID = obj.OwnerID; | ||
4354 | detobj.posVector = obj.AbsolutePosition; | ||
4355 | detobj.rotQuat = obj.GetWorldRotation(); | ||
4356 | detobj.velVector = obj.Velocity; | ||
4357 | detobj.colliderType = 0; | ||
4358 | detobj.groupUUID = obj.GroupID; | ||
4359 | colliding.Add(detobj); | ||
4360 | } | 4349 | } |
4361 | } | 4350 | } |
4351 | //add the items that started colliding this time to the last colliders list. | ||
4352 | foreach (uint localID in startedColliders) | ||
4353 | { | ||
4354 | m_lastColliders.Add(localID); | ||
4355 | } | ||
4356 | // remove things that ended colliding from the last colliders list | ||
4357 | foreach (uint localID in endedColliders) | ||
4358 | { | ||
4359 | m_lastColliders.Remove(localID); | ||
4360 | } | ||
4362 | 4361 | ||
4363 | if (colliding.Count > 0) | 4362 | if (soundinfolist.Count > 0) |
4363 | CollisionSounds.AvatarCollisionSound(this, soundinfolist); | ||
4364 | |||
4365 | // do event notification | ||
4366 | if (startedColliders.Count > 0) | ||
4364 | { | 4367 | { |
4365 | StartCollidingMessage.Colliders = colliding; | ||
4366 | 4368 | ||
4367 | foreach (SceneObjectGroup att in GetAttachments()) | 4369 | ColliderArgs StartCollidingMessage = new ColliderArgs(); |
4368 | Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); | 4370 | List<DetectedObject> colliding = new List<DetectedObject>(); |
4371 | foreach (uint localId in startedColliders) | ||
4372 | { | ||
4373 | if (localId == 0) | ||
4374 | continue; | ||
4375 | |||
4376 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | ||
4377 | string data = ""; | ||
4378 | if (obj != null) | ||
4379 | { | ||
4380 | DetectedObject detobj = new DetectedObject(); | ||
4381 | detobj.keyUUID = obj.UUID; | ||
4382 | detobj.nameStr = obj.Name; | ||
4383 | detobj.ownerUUID = obj.OwnerID; | ||
4384 | detobj.posVector = obj.AbsolutePosition; | ||
4385 | detobj.rotQuat = obj.GetWorldRotation(); | ||
4386 | detobj.velVector = obj.Velocity; | ||
4387 | detobj.colliderType = 0; | ||
4388 | detobj.groupUUID = obj.GroupID; | ||
4389 | colliding.Add(detobj); | ||
4390 | } | ||
4391 | } | ||
4392 | |||
4393 | if (colliding.Count > 0) | ||
4394 | { | ||
4395 | StartCollidingMessage.Colliders = colliding; | ||
4396 | |||
4397 | foreach (SceneObjectGroup att in GetAttachments()) | ||
4398 | Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); | ||
4399 | } | ||
4369 | } | 4400 | } |
4370 | } | 4401 | } |
4371 | 4402 | ||
@@ -4446,7 +4477,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4446 | { | 4477 | { |
4447 | m_collisionEventFlag = false; | 4478 | m_collisionEventFlag = false; |
4448 | } | 4479 | } |
4449 | }); | 4480 | // }); |
4450 | } | 4481 | } |
4451 | 4482 | ||
4452 | private void TeleportFlagsDebug() { | 4483 | private void TeleportFlagsDebug() { |