cosmetics

This commit is contained in:
UbitUmarov
2025-06-20 04:38:51 +01:00
parent 157de21332
commit e1b5f3ad81
7 changed files with 25 additions and 14 deletions

View File

@@ -368,7 +368,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS
// The step is presumed to be more or less vertical. Thus the Z component should
// be nearly horizontal.
OMV.Vector3 directionFacing = OMV.Vector3.UnitX * m_controllingPrim.RawOrientation;
OMV.Vector3 touchNormal = OMV.Vector3.Normalize(kvp.Value.SurfaceNormal);
OMV.Vector3 touchNormal = kvp.Value.SurfaceNormal;
touchNormal.Normalize();
const float PIOver2 = 1.571f; // Used to make unit vector axis into approx radian angles
// m_physicsScene.DetailLog("{0},BSCharacter.WalkUpStairs,avNormal={1},colNormal={2},diff={3}",
// m_controllingPrim.LocalID, directionFacing, touchNormal,

View File

@@ -945,7 +945,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
{
get
{
return VehicleVelocity * Quaternion.Inverse(Quaternion.Normalize(VehicleFrameOrientation));
return VehicleVelocity * Quaternion.Inverse(VehicleFrameOrientation);
}
}
@@ -1502,9 +1502,11 @@ namespace OpenSim.Region.PhysicsModule.BulletS
Quaternion justZOrientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, currentEulerW.Z);
// Create the axis that is perpendicular to the up vector and the rotated up vector.
Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, Vector3.UnitZ * VehicleFrameOrientation);
Vector3 UnitZInFrame = Vector3.UnitZ * VehicleFrameOrientation;
Vector3 differenceAxisW = Vector3.Cross(Vector3.UnitZ * justZOrientation, UnitZInFrame);
// Compute the angle between those to vectors.
double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, Vector3.Normalize(Vector3.UnitZ * VehicleFrameOrientation)));
UnitZInFrame.Normalize();
double differenceAngle = Math.Acos((double)Vector3.Dot(Vector3.UnitZ, UnitZInFrame));
// 'differenceAngle' is the angle to rotate and 'differenceAxis' is the plane to rotate in to get the vehicle vertical
// Reduce the change by the time period it is to change in. Timestep is handled when velocity is applied.
@@ -1537,7 +1539,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
Vector3 origRotVelW = VehicleRotationalVelocity; // DEBUG DEBUG
// Take a vector pointing up and convert it from world to vehicle relative coords.
Vector3 verticalError = Vector3.Normalize(Vector3.UnitZ * VehicleFrameOrientation);
Vector3 verticalError = Vector3.UnitZ * VehicleFrameOrientation;
verticalError.Normalize();
// If vertical attraction correction is needed, the vector that was pointing up (UnitZ)
// is now:

View File

@@ -358,6 +358,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation));
OMV.Vector3 origRootPosition = LinksetRoot.RawPosition;
OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(LinksetRoot.RawOrientation);
invRootOrientation.Normalize();
// 'centerDisplacementV' is the vehicle relative distance from the simulator root position to the center-of-mass
OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation;
@@ -396,7 +398,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS
// Offset the child shape from the center-of-mass and rotate it to root relative.
OMV.Vector3 offsetPos = (cPrim.RawPosition - origRootPosition) * invRootOrientation - centerDisplacementV;
OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation;
OMV.Quaternion offsetRot = cPrim.RawOrientation;
offsetRot.Normalize();
offsetRot *= invRootOrientation;
// Add the child shape to the compound shape being built
if (childShape.physShapeInfo.HasPhysicalShape)

View File

@@ -354,7 +354,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
{
get
{
OMV.Vector3 characterOrientedVelocity = RawVelocity * OMV.Quaternion.Inverse(OMV.Quaternion.Normalize(RawOrientation));
OMV.Vector3 characterOrientedVelocity = RawVelocity * OMV.Quaternion.Inverse(RawOrientation);
return characterOrientedVelocity.X;
}
}
@@ -363,7 +363,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS
{
get
{
OMV.Vector3 characterOrientedVelocity = TargetVelocity * OMV.Quaternion.Inverse(OMV.Quaternion.Normalize(RawOrientation));
OMV.Vector3 characterOrientedVelocity = TargetVelocity * OMV.Quaternion.Inverse(RawOrientation);
return characterOrientedVelocity.X;
}
}

View File

@@ -1000,7 +1000,8 @@ namespace OpenSim.Region.PhysicsModule.BulletS
if (BSParam.UseBulletRaycast)
{
Vector3 posFrom = position;
Vector3 posTo = Vector3.Normalize(direction) * length + position;
direction.Normalize();
Vector3 posTo = direction * length + position;
TaintedObject(DetailLogZero, "BSScene.RaycastWorld1", delegate ()
{