public ScreenCollisionBorder(float screenWidth, float screenHeight, PhysicsSimulator physicsSimulator ) { LeftBorder = new RectangleRigidBody(borderThickness, screenHeight, 1); LeftBorder.Position = new Vector2(-borderThickness/2,screenHeight/2); LeftBorder.FrictionCoefficient = .3f; LeftBorder.IsStatic = true; RightBorder = new RectangleRigidBody(borderThickness, screenHeight, 1); RightBorder.Position = new Vector2(screenWidth + borderThickness / 2, screenHeight / 2); RightBorder.FrictionCoefficient = .3f; RightBorder.IsStatic = true; TopBorder = new RectangleRigidBody(screenWidth, borderThickness, 1); TopBorder.Position = new Vector2(screenWidth / 2, -borderThickness / 2); TopBorder.FrictionCoefficient = .3f; TopBorder.IsStatic = true; BottomBorder = new RectangleRigidBody(screenWidth, borderThickness, 1); BottomBorder.Position = new Vector2(screenWidth / 2, screenHeight + borderThickness / 2); BottomBorder.FrictionCoefficient = .3f; BottomBorder.IsStatic = true; physicsSimulator.Add(LeftBorder); physicsSimulator.Add(RightBorder); physicsSimulator.Add(TopBorder); physicsSimulator.Add(BottomBorder); }
public cRigidBodyRectangleObject(float width, float height, float mass, float collisionPrecisionFactor) { RigidBody = new RectangleRigidBody(width, height, mass, collisionPrecisionFactor); cPhysics.Instance.addObject(this); }
public cRigidBodyRectangleObject(float width, float height, float mass) { RigidBody = new RectangleRigidBody(width, height, mass); cPhysics.Instance.addObject(this); }