From 124be38f745b884fac5dbdb6ef963387235f6108 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 20 Nov 2014 21:28:12 +0000 Subject: [PATCH] Add [BulletSim] option AvatarToAvatarCollisionsByDefault to control whether avatars collide. This is true by default. This is implemented with a new collision type (PhantomToOthersAvatar) to potentially allow colliding and non-colliding avatars to be present in the same scene. So there is no provision yet for giving avatars different collision types. This commit replaces the temporary change in commit f3eaa6d8 where avatars would never collide when using BulletSim This is equivalent to the av_av_collisions_off option in ODE. --- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 8 ++++++-- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs | 8 +++++++- bin/OpenSim.ini.example | 5 +++++ bin/OpenSimDefaults.ini | 3 +++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index a3039721d2..4c54f9ff27 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -174,15 +174,19 @@ public sealed class BSCharacter : BSPhysObject PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody); // Do this after the object has been added to the world - PhysBody.collisionType = CollisionType.Avatar; + if (BSParam.AvatarToAvatarCollisionsByDefault) + PhysBody.collisionType = CollisionType.Avatar; + else + PhysBody.collisionType = CollisionType.PhantomToOthersAvatar; + PhysBody.ApplyCollisionMask(PhysScene); } - public override void RequestPhysicsterseUpdate() { base.RequestPhysicsterseUpdate(); } + // No one calls this method so I don't know what it could possibly mean public override bool Stopped { get { return false; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 867d6ff903..e7f4deffe0 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -132,6 +132,7 @@ public static class BSParam public static float PhysicsUnmanLoggingFrames { get; private set; } // Avatar parameters + public static bool AvatarToAvatarCollisionsByDefault { get; private set; } public static float AvatarFriction { get; private set; } public static float AvatarStandingFriction { get; private set; } public static float AvatarAlwaysRunFactor { get; private set; } @@ -571,6 +572,8 @@ public static class BSParam new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 0.04f ), + new ParameterDefn("AvatarToAvatarCollisionsByDefault", "Should avatars collide with other avatars by default?", + true), new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 0.2f ), new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index 85ef64b104..59324611d6 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs @@ -190,6 +190,7 @@ public class BulletHMapInfo public enum CollisionType { Avatar, + PhantomToOthersAvatar, // An avatar that it phantom to other avatars but not to anything else Groundplane, Terrain, Static, @@ -231,7 +232,12 @@ public static Dictionary CollisionTypeM { CollisionType.Avatar, new CollisionTypeFilterGroup(CollisionType.Avatar, (uint)CollisionFilterGroups.BCharacterGroup, - (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BCharacterGroup)) + (uint)(CollisionFilterGroups.BAllGroup)) + }, + { CollisionType.PhantomToOthersAvatar, + new CollisionTypeFilterGroup(CollisionType.PhantomToOthersAvatar, + (uint)CollisionFilterGroups.BCharacterGroup, + (uint)(CollisionFilterGroups.BAllGroup & ~CollisionFilterGroups.BCharacterGroup)) }, { CollisionType.Groundplane, new CollisionTypeFilterGroup(CollisionType.Groundplane, diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 573180abec..037487779b 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -619,6 +619,11 @@ ; ForwardOfflineGroupMessages = true +[BulletSim] + ;# {AvatarToAvatarCollisionsByDefault} {[Startup]physics:BulletSim} {Should avatars collide with each other?} {true false} true + AvatarToAvatarCollisionsByDefault = true + + [ODEPhysicsSettings] ;# {mesh_sculpted_prim} {[Startup]physics:OpenDynamicsEngine} {Mesh sculpties so they collide as they look?} {true false} true ;; Do we want to mesh sculpted prim to collide like they look? diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 0be4af53d1..e89fa0aed5 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1045,6 +1045,9 @@ ; magnifications use lots of memory. TerrainMeshMagnification = 2 + ; Should avatars collide with each other? + AvatarToAvatarCollisionsByDefault = true + ; Avatar physics height adjustments. ; http://opensimulator.org/wiki/BulletSim#Adjusting_Avatar_Height AvatarHeightLowFudge = 0 ; Adjustment at low end of height range