From 7bb5613dc665a788e1b151278c20d415f708242a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Dec 2012 16:46:43 -0800 Subject: BulletSim: updates and rearrangement of the TODO list. --- .../Region/Physics/BulletSPlugin/BulletSimTODO.txt | 47 +++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 1c7b577..11c1387 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -20,6 +20,10 @@ Neb car jiggling left and right Happens on terrain and any other mesh object. Flat cubes are much smoother. This has been reduced but not eliminated. For limitMotorUp, use raycast down to find if vehicle is in the air. +Angular motion around Z moves the vehicle in world Z and not vehicle Z in ODE. + Verify that angular motion specified around Z moves in the vehicle coordinates. +Verify llGetVel() is returning a smooth and good value for vehicle movement. +llGetVel() should return the root's velocity if requested in a child prim. Implement function efficiency for lineaar and angular motion. Should vehicle angular/linear movement friction happen after all the components or does it only apply to the basic movement? @@ -32,19 +36,14 @@ Border crossing with linked vehicle causes crash BULLETSIM TODO LIST: ================================================= -Avatar height off after unsitting (float off ground) +Avatar height off after unsitting (floats off ground) Editting appearance then moving restores. Must not be initializing height when recreating capsule after unsit. Duplicating a physical prim causes old prim to jump away Dup a phys prim and the original become unselected and thus interacts w/ selected prim. -Disable activity of passive linkset children. - Since the linkset is a compound object, the old prims are left lying - around and need to be phantomized so they don't collide, ... Scenes with hundred of thousands of static objects take a lot of physics CPU time. BSPrim.Force should set a continious force on the prim. The force should be applied each tick. Some limits? -Linksets should allow collisions to individual children - Add LocalID to children shapes in LinksetCompound and create events for individuals Gun sending shooter flying. Collision margin (gap between physical objects lying on each other) Boundry checking (crashes related to crossing boundry) @@ -57,14 +56,34 @@ Small physical objects do not interact correctly The chain will fall apart and pairs will dance around on ground Chains of 1x1x.2 will stay connected but will dance. Chains above 2x2x.4 are move stable and get stablier as torui get larger. -Add material type linkage and input all the material property definitions. - Skeleton classes and table are in the sources but are not filled or used. Add PID motor for avatar movement (slow to stop, ...) setForce should set a constant force. Different than AddImpulse. Implement raycast. Implement ShapeCollection.Dispose() Implement water as a plain so raycasting and collisions can happen with same. +Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE + Also osGetPhysicsEngineVerion() maybe. + +LINKSETS +====================================================== +Linksets should allow collisions to individual children + Add LocalID to children shapes in LinksetCompound and create events for individuals +Verify/think through scripts in children of linksets. What do they reference + and return when getting position, velocity, ... +Confirm constraint linksets still work after making all the changes for compound linksets. +Add 'changed' flag or similar to reduce the number of times a linkset is rebuilt. + For compound linksets, add ability to remove or reposition individual child shapes. +Disable activity of passive linkset children. + Since the linkset is a compound object, the old prims are left lying + around and need to be phantomized so they don't collide, ... +Speed up creation of large physical linksets + For instance, sitting in Neb's car (130 prims) takes several seconds to become physical +Eliminate collisions between objects in a linkset. (LinksetConstraint) + Have UserPointer point to struct with localID and linksetID? + Objects in original linkset still collide with each other? +MORE +====================================================== Find/remove avatar collision with ID=0. Test avatar walking up stairs. How does compare with SL. Radius of the capsule affects ability to climb edges. @@ -73,8 +92,6 @@ Debounce avatar contact so legs don't keep folding up when standing. Implement LSL physics controls. Like STATUS_ROTATE_X. Add border extensions to terrain to help region crossings and objects leaving region. -Speed up creation of large physical linksets - For instance, sitting in Neb's car (130 prims) takes several seconds to become physical Performance test with lots of avatars. Can BulletSim support a thousand? Optimize collisions in C++: only send up to the object subscribed to collisions. Use collision subscription and remove the collsion(A,B) and collision(B,A) @@ -85,10 +102,6 @@ Avatar jump Performance measurement and changes to make quicker. Implement detailed physics stats (GetStats()). -Eliminate collisions between objects in a linkset. (LinksetConstraint) - Have UserPointer point to struct with localID and linksetID? - Objects in original linkset still collide with each other? - Measure performance improvement from hulls Test not using ghost objects for volume detect implementation. Performance of closures and delegates for taint processing @@ -101,6 +114,9 @@ Physics Arena central pyramid: why is one side permiable? INTERNAL IMPROVEMENT/CLEANUP ================================================= +Consider moving prim/character body and shape destruction in destroy() + to postTimeTime rather than protecting all the potential sets that + might have been queued up. Remove unused fields from ShapeData (not used in API2) Breakout code for mesh/hull/compound/native into separate BSShape* classes Standardize access to building and reference code. @@ -154,3 +170,6 @@ Package Bullet source mods for Bullet internal stats output (Resolution: move code into WorldData.h rather than relying on patches) Single prim vehicles don't seem to properly vehiclize. (Resolution: mass was not getting set properly for single prim linksets) +Add material type linkage and input all the material property definitions. + Skeleton classes and table are in the sources but are not filled or used. + (Resolution: -- cgit v1.1 From 6f1f7f02065520d061745afff9b1ed1bd672d87b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 12 Dec 2012 15:07:17 -0800 Subject: BulletSim: non-functional commenting and reorganization of material attribute specifications. --- .../Region/Physics/BulletSPlugin/BSMaterials.cs | 81 +++++++++++++--------- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 1 + 2 files changed, 49 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs index 390c2f9..c113a43 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs @@ -50,10 +50,11 @@ public struct MaterialAttributes Avatar, NumberOfTypes // the count of types in the enum. } + // Names must be in the order of the above enum. - public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", - "Flesh", "Plastic", "Rubber", "Light", "Avatar" }; - public static string[] MaterialAttribs = { "Density", "Friction", "Restitution"}; + // These names must coorespond to the lower case field names in the MaterialAttributes + // structure as reflection is used to select the field to put the value in. + public static readonly string[] MaterialAttribs = { "Density", "Friction", "Restitution"}; public MaterialAttributes(string t, float d, float f, float r) { @@ -70,60 +71,74 @@ public struct MaterialAttributes public static class BSMaterials { - public static MaterialAttributes[] Attributes; + // Attributes for each material type + private static readonly MaterialAttributes[] Attributes; + + // Map of material name to material type code + public static readonly Dictionary MaterialMap; static BSMaterials() { // Attribute sets for both the non-physical and physical instances of materials. Attributes = new MaterialAttributes[(int)MaterialAttributes.Material.NumberOfTypes * 2]; + + // Map of name to type code. + MaterialMap = new Dictionary(); + MaterialMap.Add("Stone", MaterialAttributes.Material.Stone); + MaterialMap.Add("Metal", MaterialAttributes.Material.Metal); + MaterialMap.Add("Glass", MaterialAttributes.Material.Glass); + MaterialMap.Add("Wood", MaterialAttributes.Material.Wood); + MaterialMap.Add("Flesh", MaterialAttributes.Material.Flesh); + MaterialMap.Add("Plastic", MaterialAttributes.Material.Plastic); + MaterialMap.Add("Rubber", MaterialAttributes.Material.Rubber); + MaterialMap.Add("Light", MaterialAttributes.Material.Light); + MaterialMap.Add("Avatar", MaterialAttributes.Material.Avatar); } // This is where all the default material attributes are defined. public static void InitializeFromDefaults(ConfigurationParameters parms) { // Values from http://wiki.secondlife.com/wiki/PRIM_MATERIAL - // public static string[] MaterialNames = { "Stone", "Metal", "Glass", "Wood", - // "Flesh", "Plastic", "Rubber", "Light", "Avatar" }; + float dDensity = parms.defaultDensity; float dFriction = parms.defaultFriction; float dRestitution = parms.defaultRestitution; - float dDensity = parms.defaultDensity; Attributes[(int)MaterialAttributes.Material.Stone] = - new MaterialAttributes("stone",dDensity, 0.8f, 0.4f); + new MaterialAttributes("stone",dDensity, 0.8f, 0.4f); Attributes[(int)MaterialAttributes.Material.Metal] = - new MaterialAttributes("metal",dDensity, 0.3f, 0.4f); + new MaterialAttributes("metal",dDensity, 0.3f, 0.4f); Attributes[(int)MaterialAttributes.Material.Glass] = - new MaterialAttributes("glass",dDensity, 0.2f, 0.7f); + new MaterialAttributes("glass",dDensity, 0.2f, 0.7f); Attributes[(int)MaterialAttributes.Material.Wood] = - new MaterialAttributes("wood",dDensity, 0.6f, 0.5f); + new MaterialAttributes("wood",dDensity, 0.6f, 0.5f); Attributes[(int)MaterialAttributes.Material.Flesh] = - new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f); + new MaterialAttributes("flesh",dDensity, 0.9f, 0.3f); Attributes[(int)MaterialAttributes.Material.Plastic] = - new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f); + new MaterialAttributes("plastic",dDensity, 0.4f, 0.7f); Attributes[(int)MaterialAttributes.Material.Rubber] = - new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f); + new MaterialAttributes("rubber",dDensity, 0.9f, 0.9f); Attributes[(int)MaterialAttributes.Material.Light] = - new MaterialAttributes("light",dDensity, dFriction, dRestitution); + new MaterialAttributes("light",dDensity, dFriction, dRestitution); Attributes[(int)MaterialAttributes.Material.Avatar] = - new MaterialAttributes("avatar",60f, 0.2f, 0f); + new MaterialAttributes("avatar",60f, 0.2f, 0f); Attributes[(int)MaterialAttributes.Material.Stone + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f); + new MaterialAttributes("stonePhysical",dDensity, 0.8f, 0.4f); Attributes[(int)MaterialAttributes.Material.Metal + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f); + new MaterialAttributes("metalPhysical",dDensity, 0.8f, 0.4f); Attributes[(int)MaterialAttributes.Material.Glass + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f); + new MaterialAttributes("glassPhysical",dDensity, 0.8f, 0.7f); Attributes[(int)MaterialAttributes.Material.Wood + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f); + new MaterialAttributes("woodPhysical",dDensity, 0.8f, 0.5f); Attributes[(int)MaterialAttributes.Material.Flesh + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f); + new MaterialAttributes("fleshPhysical",dDensity, 0.8f, 0.3f); Attributes[(int)MaterialAttributes.Material.Plastic + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f); + new MaterialAttributes("plasticPhysical",dDensity, 0.8f, 0.7f); Attributes[(int)MaterialAttributes.Material.Rubber + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f); + new MaterialAttributes("rubberPhysical",dDensity, 0.8f, 0.9f); Attributes[(int)MaterialAttributes.Material.Light + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution); + new MaterialAttributes("lightPhysical",dDensity, dFriction, dRestitution); Attributes[(int)MaterialAttributes.Material.Avatar + (int)MaterialAttributes.Material.NumberOfTypes] = - new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f); + new MaterialAttributes("avatarPhysical",60f, 0.2f, 0f); } // Under the [BulletSim] section, one can change the individual material @@ -139,34 +154,34 @@ public static class BSMaterials // the physical value. public static void InitializefromParameters(IConfig pConfig) { - int matType = 0; - foreach (string matName in MaterialAttributes.MaterialNames) + foreach (KeyValuePair kvp in MaterialMap) { + string matName = kvp.Key; foreach (string attribName in MaterialAttributes.MaterialAttribs) { string paramName = matName + attribName; if (pConfig.Contains(paramName)) { float paramValue = pConfig.GetFloat(paramName); - SetAttributeValue(matType, attribName, paramValue); + SetAttributeValue((int)kvp.Value, attribName, paramValue); // set the physical value also - SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); + SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); } paramName += "Physical"; if (pConfig.Contains(paramName)) { float paramValue = pConfig.GetFloat(paramName); - SetAttributeValue(matType + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); + SetAttributeValue((int)kvp.Value + (int)MaterialAttributes.Material.NumberOfTypes, attribName, paramValue); } } - matType++; } } + // Use reflection to set the value in the attribute structure. private static void SetAttributeValue(int matType, string attribName, float val) { MaterialAttributes thisAttrib = Attributes[matType]; - FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName); + FieldInfo fieldInfo = thisAttrib.GetType().GetField(attribName.ToLower()); if (fieldInfo != null) { fieldInfo.SetValue(thisAttrib, val); @@ -174,12 +189,12 @@ public static class BSMaterials } } + // Given a material type, return a structure of attributes. public static MaterialAttributes GetAttributes(MaterialAttributes.Material type, bool isPhysical) { int ind = (int)type; if (isPhysical) ind += (int)MaterialAttributes.Material.NumberOfTypes; return Attributes[ind]; } - } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index f4f2801..cf5bb57 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -309,6 +309,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters BSMaterials.InitializeFromDefaults(Params); if (pConfig != null) { + // Let the user add new and interesting material property values. BSMaterials.InitializefromParameters(pConfig); } } -- cgit v1.1 From e1814aa827c2d0af21d087bd34e3c7f4f7cf25bd Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 12 Dec 2012 16:29:03 -0800 Subject: BulletSim: fix problem of avatar's floating off the ground after unsitting. Reworked size/scale logic so physical scale is kept in Bullet and physObject scale is the preferred size -- usually same as size but avatars are computed differently. --- .../Region/Physics/BulletSPlugin/BSCharacter.cs | 18 +++++++++-------- .../Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 8 ++------ .../Physics/BulletSPlugin/BSShapeCollection.cs | 23 +++++++++++++--------- 4 files changed, 27 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 83c78f6..c8aad8d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -105,12 +105,12 @@ public sealed class BSCharacter : BSPhysObject DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}", LocalID, _size, Scale, _avatarDensity, _avatarVolume, RawMass); - // do actual create at taint time + // do actual creation in taint time PhysicsScene.TaintedObject("BSCharacter.create", delegate() { DetailLog("{0},BSCharacter.create,taint", LocalID); // New body and shape into PhysBody and PhysShape - PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, null, null); + PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this); SetPhysicalProperties(); }); @@ -189,6 +189,11 @@ public sealed class BSCharacter : BSPhysObject set { // When an avatar's size is set, only the height is changed. _size = value; + // Old versions of ScenePresence passed only the height. If width and/or depth are zero, + // replace with the default values. + if (_size.X == 0f) _size.X = PhysicsScene.Params.avatarCapsuleDepth; + if (_size.Y == 0f) _size.Y = PhysicsScene.Params.avatarCapsuleWidth; + ComputeAvatarScale(_size); ComputeAvatarVolumeAndMass(); DetailLog("{0},BSCharacter.setSize,call,size={1},scale={2},density={3},volume={4},mass={5}", @@ -196,18 +201,18 @@ public sealed class BSCharacter : BSPhysObject PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() { - if (PhysShape.HasPhysicalShape) + if (PhysBody.HasPhysicalBody && PhysShape.HasPhysicalShape) { BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale); UpdatePhysicalMassProperties(RawMass); + // Make sure this change appears as a property update event + BulletSimAPI.PushUpdate2(PhysBody.ptr); } }); } } - public override OMV.Vector3 Scale { get; set; } - public override PrimitiveBaseShape Shape { set { BaseShape = value; } @@ -638,9 +643,6 @@ public sealed class BSCharacter : BSPhysObject private void ComputeAvatarScale(OMV.Vector3 size) { - // The 'size' given by the simulator is the mid-point of the avatar - // and X and Y are unspecified. - OMV.Vector3 newScale = size; // newScale.X = PhysicsScene.Params.avatarCapsuleWidth; // newScale.Y = PhysicsScene.Params.avatarCapsuleDepth; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index f3b6993..6539b43 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -109,7 +109,7 @@ public abstract class BSPhysObject : PhysicsActor public EntityProperties CurrentEntityProperties { get; set; } public EntityProperties LastEntityProperties { get; set; } - public abstract OMV.Vector3 Scale { get; set; } + public virtual OMV.Vector3 Scale { get; set; } public abstract bool IsSolid { get; } public abstract bool IsStatic { get; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 35d22c0..19c29cc 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -45,7 +45,6 @@ public sealed class BSPrim : BSPhysObject private static readonly string LogHeader = "[BULLETS PRIM]"; // _size is what the user passed. Scale is what we pass to the physics engine with the mesh. - // Often Scale is unity because the meshmerizer will apply _size when creating the mesh. private OMV.Vector3 _size; // the multiplier for each mesh dimension as passed by the user private bool _grabbed; @@ -93,7 +92,7 @@ public sealed class BSPrim : BSPhysObject _physicsActorType = (int)ActorTypes.Prim; _position = pos; _size = size; - Scale = size; // the scale will be set by CreateGeom depending on object type + Scale = size; // prims are the size the user wants them to be (different for BSCharactes). _orientation = rotation; _buoyancy = 1f; _velocity = OMV.Vector3.Zero; @@ -159,12 +158,10 @@ public sealed class BSPrim : BSPhysObject // We presume the scale and size are the same. If scale must be changed for // the physical shape, that is done when the geometry is built. _size = value; + Scale = _size; ForceBodyShapeRebuild(false); } } - // Scale is what we set in the physics engine. It is different than 'size' in that - // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>. - public override OMV.Vector3 Scale { get; set; } public override PrimitiveBaseShape Shape { set { @@ -1369,7 +1366,6 @@ public sealed class BSPrim : BSPhysObject // Create the correct physical representation for this type of object. // Updates PhysBody and PhysShape with the new information. // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary. - // Returns 'true' if either the body or the shape was changed. PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, null, delegate(BulletBody dBody) { // Called if the current prim body is about to be destroyed. diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 4ab9a99..ea996ae 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs @@ -126,6 +126,11 @@ public sealed class BSShapeCollection : IDisposable return ret; } + public bool GetBodyAndShape(bool forceRebuild, BulletSim sim, BSPhysObject prim) + { + return GetBodyAndShape(forceRebuild, sim, prim, null, null); + } + // Track another user of a body. // We presume the caller has allocated the body. // Bodies only have one user so the body is just put into the world if not already there. @@ -460,6 +465,11 @@ public sealed class BSShapeCollection : IDisposable && pbs.PathScaleX == 100 && pbs.PathScaleY == 100 && pbs.PathShearX == 0 && pbs.PathShearY == 0) ) ) { + // Get the scale of any existing shape so we can see if the new shape is same native type and same size. + OMV.Vector3 scaleOfExistingShape = OMV.Vector3.Zero; + if (prim.PhysShape.HasPhysicalShape) + scaleOfExistingShape = BulletSimAPI.GetLocalScaling2(prim.PhysShape.ptr); + if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,maybeNative,force={1},primScale={2},primSize={3},primShape={4}", prim.LocalID, forceRebuild, prim.Scale, prim.Size, prim.PhysShape.type); @@ -469,7 +479,7 @@ public sealed class BSShapeCollection : IDisposable { haveShape = true; if (forceRebuild - || prim.Scale != prim.Size + || prim.Scale != scaleOfExistingShape || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_SPHERE ) { @@ -483,7 +493,7 @@ public sealed class BSShapeCollection : IDisposable { haveShape = true; if (forceRebuild - || prim.Scale != prim.Size + || prim.Scale != scaleOfExistingShape || prim.PhysShape.type != BSPhysicsShapeType.SHAPE_BOX ) { @@ -542,7 +552,6 @@ public sealed class BSShapeCollection : IDisposable prim.LocalID, newShape, prim.Scale); // native shapes are scaled by Bullet - prim.Scale = prim.Size; prim.PhysShape = newShape; return true; } @@ -555,8 +564,8 @@ public sealed class BSShapeCollection : IDisposable ShapeData nativeShapeData = new ShapeData(); nativeShapeData.Type = shapeType; nativeShapeData.ID = prim.LocalID; - nativeShapeData.Scale = prim.Size; - nativeShapeData.Size = prim.Size; // unneeded, I think. + nativeShapeData.Scale = prim.Scale; + nativeShapeData.Size = prim.Scale; // unneeded, I think. nativeShapeData.MeshKey = (ulong)shapeKey; nativeShapeData.HullKey = (ulong)shapeKey; @@ -611,8 +620,6 @@ public sealed class BSShapeCollection : IDisposable ReferenceShape(newShape); - // meshes are already scaled by the meshmerizer - prim.Scale = new OMV.Vector3(1f, 1f, 1f); prim.PhysShape = newShape; return true; // 'true' means a new shape has been added to this prim @@ -683,8 +690,6 @@ public sealed class BSShapeCollection : IDisposable ReferenceShape(newShape); - // hulls are already scaled by the meshmerizer - prim.Scale = new OMV.Vector3(1f, 1f, 1f); prim.PhysShape = newShape; return true; // 'true' means a new shape has been added to this prim } -- cgit v1.1