/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { ///must be called before all base.LoadContent(GraphicInfo, factory, contentManager); List <IObject> balls = new List <IObject>(); Vector3 pos1, pos2; pos1 = new Vector3(0, 20, 0); pos2 = new Vector3(0, -50, 0); IObject ball1 = CreateSphere(pos1, Matrix.Identity, Color.Red); ball1.PhysicObject.isMotionLess = true; // Setting the Parent object as static World.AddObject(ball1); IObject ball2 = CreateSphere(pos2, Matrix.Identity, Color.White); World.AddObject(ball2); balls.Add(ball2); constraint = new PointPointConstraint((pos1 + pos2) / 2, ball1.PhysicObject, ball2.PhysicObject); World.PhysicWorld.AddConstraint(constraint); ///Add some directional lights to completely iluminate the world #region Lights DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.4f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion lt = new LightThrowBepu(this.World, factory); lt.force = 60; ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
public static IPhysicConstraint CreateConstraint(IWorld world, GraphicFactory factory, GraphicInfo ginfo, ConstraintInfo cinfo, IObject o1, IObject o2) { PointPointConstraint con = new PointPointConstraint(cinfo.Position, o1.PhysicObject, o2.PhysicObject); return(con); }