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.
ghosts
Justin Clark-Casey (justincc) 2014-11-20 21:28:12 +00:00
parent bf5e220450
commit df75f14bca
5 changed files with 24 additions and 3 deletions

View File

@ -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; } }

View File

@ -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<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
0.04f ),
new ParameterDefn<bool>("AvatarToAvatarCollisionsByDefault", "Should avatars collide with other avatars by default?",
true),
new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
0.2f ),
new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",

View File

@ -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<CollisionType, CollisionTypeFilterGroup> 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,

View File

@ -606,6 +606,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?

View File

@ -1035,6 +1035,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