mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 09:16:28 +08:00
remove option ClampNegativeZ
This commit is contained in:
@@ -301,29 +301,51 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// KF: Check for out-of-region, move inside and make static.
|
||||
Vector3 npos = sceneObject.RootPart.GroupPosition;
|
||||
bool clampZ = m_parentScene.ClampNegativeZ;
|
||||
|
||||
if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && (sceneObject.RootPart.Shape.State != 0)) && (npos.X < 0.0 || npos.Y < 0.0 || (npos.Z < 0.0 && clampZ) ||
|
||||
npos.X > regionSizeX || npos.Y > regionSizeY))
|
||||
if (!((sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) && sceneObject.RootPart.Shape.State != 0))
|
||||
{
|
||||
if (npos.X < 0.0) npos.X = 1.0f;
|
||||
if (npos.Y < 0.0) npos.Y = 1.0f;
|
||||
if (npos.Z < 0.0 && clampZ) npos.Z = 0.0f;
|
||||
if (npos.X > regionSizeX) npos.X = regionSizeX - 1.0f;
|
||||
if (npos.Y > regionSizeY) npos.Y = regionSizeY - 1.0f;
|
||||
|
||||
SceneObjectPart rootpart = sceneObject.RootPart;
|
||||
rootpart.GroupPosition = npos;
|
||||
|
||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||
{
|
||||
if (part == rootpart)
|
||||
continue;
|
||||
part.GroupPosition = npos;
|
||||
bool clamped = false;
|
||||
if (npos.X < 0.0f)
|
||||
{
|
||||
npos.X = 1.0f;
|
||||
clamped = true;
|
||||
}
|
||||
else if (npos.X > regionSizeX)
|
||||
{
|
||||
npos.X = regionSizeX - 1.0f;
|
||||
clamped = true;
|
||||
}
|
||||
if (npos.Y < 0.0f)
|
||||
{
|
||||
npos.Y = 1.0f;
|
||||
clamped = true;
|
||||
}
|
||||
else if (npos.Y > regionSizeY)
|
||||
{
|
||||
npos.Y = regionSizeY - 1.0f;
|
||||
clamped = true;
|
||||
}
|
||||
if (npos.Z < Constants.MinSimulationHeight)
|
||||
{
|
||||
npos.Z = Constants.MinSimulationHeight;
|
||||
clamped = true;
|
||||
}
|
||||
|
||||
if(clamped)
|
||||
{
|
||||
SceneObjectPart rootpart = sceneObject.RootPart;
|
||||
rootpart.GroupPosition = npos;
|
||||
|
||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||
{
|
||||
if (part == rootpart)
|
||||
continue;
|
||||
part.GroupPosition = npos;
|
||||
}
|
||||
rootpart.Velocity = Vector3.Zero;
|
||||
rootpart.AngularVelocity = Vector3.Zero;
|
||||
rootpart.Acceleration = Vector3.Zero;
|
||||
}
|
||||
rootpart.Velocity = Vector3.Zero;
|
||||
rootpart.AngularVelocity = Vector3.Zero;
|
||||
rootpart.Acceleration = Vector3.Zero;
|
||||
}
|
||||
|
||||
bool ret = AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
|
||||
|
||||
Reference in New Issue
Block a user