コード例 #1
0
ファイル: PhysicsCommon.cs プロジェクト: zwiglm/NeoAxisEngine
        public PhysicsContactTestItem(int collisionFilterGroup, int collisionFilterMask, ModeEnum mode, Cylinder cylinder)
        {
            //cylinder works good without additional check for position of point on B.

            //var geometry = cylinder;
            //var offset = geometry.GetDirection() * 0.001;
            //geometry.Point1 -= offset;
            //geometry.Point2 += offset;
            //geometry.Radius += 0.001;

            var collisionObject = new CollisionObject();

            if (cylinder.Point1.ToVector2().Equals(cylinder.Point2.ToVector2(), 0.0001))
            {
                collisionObject.CollisionShape = new BulletSharp.CylinderShapeZ(cylinder.Radius, cylinder.Radius, cylinder.GetLength() * 0.5);
                collisionObject.WorldTransform = BulletPhysicsUtility.Convert(Matrix4.FromTranslate(cylinder.GetCenter()));
            }
            else
            {
                collisionObject.CollisionShape = new BulletSharp.CylinderShapeX(cylinder.GetLength() * 0.5, cylinder.Radius, cylinder.Radius);
                collisionObject.WorldTransform = BulletPhysicsUtility.Convert(new Matrix4(Quaternion.FromDirectionZAxisUp(cylinder.GetDirection()).ToMatrix3(), cylinder.GetCenter()));
            }

            Construct(collisionFilterGroup, collisionFilterMask, mode, collisionObject, true, null);              // point => geometry.Contains( point ) );
        }
コード例 #2
0
 //!!!!два segments как у конуса
 public abstract void AddCylinder(Cylinder cylinder, int segments = 32, bool solid = false, double lineThickness = 0);
コード例 #3
0
 public Cylinder(Cylinder source)
 {
     Point1 = source.Point1;
     Point2 = source.Point2;
     Radius = source.Radius;
 }