BulletSim: fix the problem with flying being disabled when crossing region boundries.

connector_plugin
Robert Adams 2012-11-18 22:57:26 -08:00
parent 079a1e704f
commit 22be36be69
1 changed files with 6 additions and 2 deletions

View File

@ -78,8 +78,8 @@ public sealed class BSCharacter : BSPhysObject
private float _PIDHoverTao;
public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying)
: base(parent_scene, localID, avName, "BSCharacter")
{
base.BaseInitialize(parent_scene, localID, avName, "BSCharacter");
_physicsActorType = (int)ActorTypes.Agent;
_position = pos;
_size = size;
@ -131,6 +131,10 @@ public sealed class BSCharacter : BSPhysObject
// Set the velocity and compute the proper friction
ForceVelocity = _velocity;
// This will enable or disable the flying buoyancy of the avatar.
// Needs to be reset especially when an avatar is recreated after crossing a region boundry.
Flying = _flying;
BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.avatarRestitution);
BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin);
BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);