Re: Compound B can't hold entities as angular velocity increases
Posted: Fri Nov 26, 2010 12:13 am
Thanks Norbo. I'll get on it but just stick with spheres and single contact points for now 

Former forum of queegs; use github discussions now!
https://forum.bepuentertainment.com/
Code: Select all
class HollowSphere : Entity
{
private Game1 game;
private float radius;
public HollowSphere(Game1 game, Vector3 position, float radius)
{
this.game = game;
this.radius = radius;
TeleportTo(position);
}
public void Draw()
{
//game.ShapeDrawer.DrawShape(entity, 0);
// Draw the physics entity's bounding box
if (game.Debug.Switch)
{
game.WireShapeDrawer.DrawWireBox(BoundingBox, Color.Red);
}
}
protected override void Initialize(bool physicallySimulated)
{
ForceBoundingBoxRefit(0);
InitializeNonDynamicData();
maximumRadiusFromCenterPosition = radius; //outerRadius;
maximumRadius = maximumRadiusFromCenterPosition + CenterOfMassOffset.Length();
}
public override void GetExtremePoint(ref Microsoft.Xna.Framework.Vector3 d, ref Microsoft.Xna.Framework.Vector3 positionToUse, ref Microsoft.Xna.Framework.Quaternion orientationToUse, float margin, out Microsoft.Xna.Framework.Vector3 extremePoint)
{
throw new NotImplementedException();
}
public override void GetExtremePoints(ref Microsoft.Xna.Framework.Vector3 d, out Microsoft.Xna.Framework.Vector3 min, out Microsoft.Xna.Framework.Vector3 max, float margin)
{
throw new NotImplementedException();
}
public override void GetExtremePoints(ref Microsoft.Xna.Framework.Vector3 d, ref Microsoft.Xna.Framework.Vector3 positionToUse, ref Microsoft.Xna.Framework.Quaternion orientationToUse, out Microsoft.Xna.Framework.Vector3 min, out Microsoft.Xna.Framework.Vector3 max, float margin)
{
d.Normalize();
max = d * (radius + margin) + positionToUse;
min = -d * (radius + margin) + positionToUse;
}
public float Radius
{
get { return radius; }
set { radius = value; }
}
}
Code: Select all
public override void GetExtremePoint(ref Microsoft.Xna.Framework.Vector3 d, ref Microsoft.Xna.Framework.Vector3 positionToUse, ref Microsoft.Xna.Framework.Quaternion orientationToUse, float margin, out Microsoft.Xna.Framework.Vector3 extremePoint)
{
d.Normalize();
extremePoint = d * (radius + margin) + positionToUse;
}
public override void GetExtremePoints(ref Microsoft.Xna.Framework.Vector3 d, out Microsoft.Xna.Framework.Vector3 min, out Microsoft.Xna.Framework.Vector3 max, float margin)
{
d.Normalize();
max = d * (radius + margin);
min = -d * (radius + margin);
}
public override void GetExtremePoints(ref Microsoft.Xna.Framework.Vector3 d, ref Microsoft.Xna.Framework.Vector3 positionToUse, ref Microsoft.Xna.Framework.Quaternion orientationToUse, out Microsoft.Xna.Framework.Vector3 min, out Microsoft.Xna.Framework.Vector3 max, float margin)
{
d.Normalize();
max = d * (radius + margin) + positionToUse;
min = -d * (radius + margin) + positionToUse;
}
Code: Select all
public HollowSphere(Game1 game, Vector3 position, float radius)
{
this.game = game;
this.radius = radius;
TeleportTo(position);
Initialize(true);
}