diff options
Diffstat (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 66bd099..b6e1cb4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
54 | { | 54 | { |
55 | 55 | ||
56 | } | 56 | } |
57 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) | 57 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) |
58 | { | 58 | { |
59 | BasicActor act = new BasicActor(); | 59 | BasicActor act = new BasicActor(); |
60 | act.Position = position; | 60 | act.Position = position; |
@@ -77,20 +77,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |
80 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 80 | public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) |
81 | { | 81 | { |
82 | return null; | 82 | return null; |
83 | } | 83 | } |
84 | */ | 84 | */ |
85 | 85 | ||
86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 86 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
87 | PhysicsVector size, Quaternion rotation) | 87 | Vector3 size, Quaternion rotation) |
88 | { | 88 | { |
89 | return AddPrimShape(primName, pbs, position, size, rotation, false); | 89 | return AddPrimShape(primName, pbs, position, size, rotation, false); |
90 | } | 90 | } |
91 | 91 | ||
92 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, | 92 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
93 | PhysicsVector size, Quaternion rotation, bool isPhysical) | 93 | Vector3 size, Quaternion rotation, bool isPhysical) |
94 | { | 94 | { |
95 | return null; | 95 | return null; |
96 | } | 96 | } |
@@ -105,26 +105,28 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
105 | for (int i = 0; i < _actors.Count; ++i) | 105 | for (int i = 0; i < _actors.Count; ++i) |
106 | { | 106 | { |
107 | BasicActor actor = _actors[i]; | 107 | BasicActor actor = _actors[i]; |
108 | Vector3 actorPosition = actor.Position; | ||
109 | Vector3 actorVelocity = actor.Velocity; | ||
108 | 110 | ||
109 | actor.Position.X += actor.Velocity.X*timeStep; | 111 | actorPosition.X += actor.Velocity.X*timeStep; |
110 | actor.Position.Y += actor.Velocity.Y*timeStep; | 112 | actorPosition.Y += actor.Velocity.Y*timeStep; |
111 | 113 | ||
112 | if (actor.Position.Y < 0) | 114 | if (actor.Position.Y < 0) |
113 | { | 115 | { |
114 | actor.Position.Y = 0.1F; | 116 | actorPosition.Y = 0.1F; |
115 | } | 117 | } |
116 | else if (actor.Position.Y >= Constants.RegionSize) | 118 | else if (actor.Position.Y >= Constants.RegionSize) |
117 | { | 119 | { |
118 | actor.Position.Y = ((int)Constants.RegionSize - 0.1f); | 120 | actorPosition.Y = ((int)Constants.RegionSize - 0.1f); |
119 | } | 121 | } |
120 | 122 | ||
121 | if (actor.Position.X < 0) | 123 | if (actor.Position.X < 0) |
122 | { | 124 | { |
123 | actor.Position.X = 0.1F; | 125 | actorPosition.X = 0.1F; |
124 | } | 126 | } |
125 | else if (actor.Position.X >= Constants.RegionSize) | 127 | else if (actor.Position.X >= Constants.RegionSize) |
126 | { | 128 | { |
127 | actor.Position.X = ((int)Constants.RegionSize - 0.1f); | 129 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); |
128 | } | 130 | } |
129 | 131 | ||
130 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; | 132 | float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; |
@@ -133,23 +135,27 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
133 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < | 135 | if (actor.Position.Z + (actor.Velocity.Z*timeStep) < |
134 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) | 136 | _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) |
135 | { | 137 | { |
136 | actor.Position.Z = height; | 138 | actorPosition.Z = height; |
137 | actor.Velocity.Z = 0; | 139 | actorVelocity.Z = 0; |
138 | actor.IsColliding = true; | 140 | actor.IsColliding = true; |
139 | } | 141 | } |
140 | else | 142 | else |
141 | { | 143 | { |
142 | actor.Position.Z += actor.Velocity.Z*timeStep; | 144 | actorPosition.Z += actor.Velocity.Z*timeStep; |
143 | actor.IsColliding = false; | 145 | actor.IsColliding = false; |
144 | } | 146 | } |
145 | } | 147 | } |
146 | else | 148 | else |
147 | { | 149 | { |
148 | actor.Position.Z = height; | 150 | actorPosition.Z = height; |
149 | actor.Velocity.Z = 0; | 151 | actorVelocity.Z = 0; |
150 | actor.IsColliding = true; | 152 | actor.IsColliding = true; |
151 | } | 153 | } |
154 | |||
155 | actor.Position = actorPosition; | ||
156 | actor.Velocity = actorVelocity; | ||
152 | } | 157 | } |
158 | |||
153 | return fps; | 159 | return fps; |
154 | } | 160 | } |
155 | 161 | ||