private void btnInstallApk_Click(object sender, RoutedEventArgs e) { int GroupIndex = _runningGroupIndex; SimulatorView objSimulatorView = new SimulatorView(GroupIndex); objSimulatorView.ShowDialog(); //string apkfile = $"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}/AppDatas/WhatsApp.apk"; //if (_runningGroupIndex == -1) //{ // MessageBox.Show(resourceManager.GetString("Error_Please_Launch_A_Vm", cultureInfo)); // return; //} //for (int i = 0; i < VmManager.Instance.Column; i++) //{ // int vmIndex = VmManager.Instance.VmIndexArray[_runningGroupIndex, i]; // if (vmIndex != -1) // { // int id = ProcessUtils.AdbInstallApp(vmIndex, apkfile); // Thread.Sleep(200); // } //} }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { _agentBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, 80, 80, 5); _agentBody.Position = _position; view.AddAgentToCanvas(_agentBody); _agentGeom = new Geom[7]; _agentGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _agentBody, 16, 10, new Vector2(-40, -40), 0); _agentGeom[0].RestitutionCoefficient = .4f; _agentGeom[0].FrictionCoefficient = .2f; _agentGeom[0].CollisionGroup = 1; _agentGeom[0].CollisionCategories = _collisionCategory; _agentGeom[0].CollidesWith = _collidesWith; _agentGeom[1] = GeomFactory.Instance.CreateGeom(physicsSimulator, _agentBody, _agentGeom[0], new Vector2(-40, 40), 0); _agentGeom[2] = GeomFactory.Instance.CreateGeom(physicsSimulator, _agentBody, _agentGeom[0], new Vector2(40, -40), 0); _agentGeom[3] = GeomFactory.Instance.CreateGeom(physicsSimulator, _agentBody, _agentGeom[0], new Vector2(40, 40), 0); _agentGeom[4] = GeomFactory.Instance.CreateGeom(physicsSimulator, _agentBody, _agentGeom[0], new Vector2(0, 0), 0); _agentGeom[5] = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _agentBody, 16, 120, Vector2.Zero, MathHelper.PiOver4); _agentGeom[5].CollisionGroup = 1; _agentGeom[5].CollisionCategories = _collisionCategory; _agentGeom[5].CollidesWith = _collidesWith; _agentGeom[6] = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _agentBody, 16, 120, Vector2.Zero, -MathHelper.PiOver4); _agentGeom[6].CollisionGroup = 1; _agentGeom[6].CollisionCategories = _collisionCategory; _agentGeom[6].CollidesWith = _collidesWith; }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { //use the body factory to create the physics body _borderBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _width, _height, 1); _borderBody.IsStatic = true; _borderBody.Position = _position; LoadBorderGeom(physicsSimulator); float left = (_position.X - _width / 2f); float top = (_position.Y - _height / 2f); float right = (_position.X + _width / 2f); float bottom = (_position.Y + _height / 2f); RectangleBrush r1 = view.AddRectangleToCanvas(null, Color.FromArgb(128, 255, 255, 255), new Vector2(_borderWidth * 2, ScreenManager.ScreenHeight)); r1.Extender.Position = new Vector2(left, _position.Y); RectangleBrush r2 = view.AddRectangleToCanvas(null, Color.FromArgb(128, 255, 255, 255), new Vector2(_borderWidth * 2, ScreenManager.ScreenHeight)); r2.Extender.Position = new Vector2(right, _position.Y); RectangleBrush r3 = view.AddRectangleToCanvas(null, Color.FromArgb(128, 255, 255, 255), new Vector2(ScreenManager.ScreenWidth, _borderWidth * 2)); r3.Extender.Position = new Vector2(_position.X, top); RectangleBrush r4 = view.AddRectangleToCanvas(null, Color.FromArgb(128, 255, 255, 255), new Vector2(ScreenManager.ScreenWidth, _borderWidth * 2)); r4.Extender.Position = new Vector2(_position.X, bottom); }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { _circleBody = new Body[_count]; _circleGeom = new Geom[_count]; _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, .1f); _circleBody[0].Position = _startPosition; view.AddCircleToCanvas(_circleBody[0], _color, _radius); for (int i = 1; i < _count; i++) { _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]); _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i / (float)(_count - 1)); view.AddCircleToCanvas(_circleBody[i], _color, _radius); } _circleGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _circleBody[0], _radius, 10); _circleGeom[0].RestitutionCoefficient = .7f; _circleGeom[0].FrictionCoefficient = .2f; _circleGeom[0].CollisionCategories = _collisionCategories; _circleGeom[0].CollidesWith = _collidesWith; for (int j = 1; j < _count; j++) { _circleGeom[j] = GeomFactory.Instance.CreateGeom(physicsSimulator, _circleBody[j], _circleGeom[0]); } }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { _circleBody = new Body[_count]; _circleGeom = new Geom[_count]; _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, .1f); _circleBody[0].Position = _startPosition; view.AddCircleToCanvas(_circleBody[0], _color, _radius); for (int i = 1; i < _count; i++) { _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]); _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i/(float) (_count - 1)); view.AddCircleToCanvas(_circleBody[i], _color, _radius); } _circleGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _circleBody[0], _radius, 10); _circleGeom[0].RestitutionCoefficient = .7f; _circleGeom[0].FrictionCoefficient = .2f; _circleGeom[0].CollisionCategories = _collisionCategories; _circleGeom[0].CollidesWith = _collidesWith; for (int j = 1; j < _count; j++) { _circleGeom[j] = GeomFactory.Instance.CreateGeom(physicsSimulator, _circleBody[j], _circleGeom[0]); } }
protected Simulator(UILogging spiderLogging, SimulatorView simulatorView, PageModel pageModel) { _simulatorView = simulatorView; _pageModel = pageModel; _url = _pageModel.PageUrl; _spiderLogging = spiderLogging; //_navigator.DoWork += NavigatorDoWork; }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { //use the body factory to create the physics body _floorBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _width, _height, 1); view.AddRectangleToCanvas(_floorBody, Colors.White, new Vector2(_width, _height)); _floorBody.IsStatic = true; _floorGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _floorBody, _width, _height); _floorGeom.RestitutionCoefficient = .4f; _floorGeom.FrictionCoefficient = .4f; _floorBody.Position = _position; }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { //use the body factory to create the physics body _platformBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _width, _height, 1); view.AddRectangleToCanvas(_platformBody, Colors.White, new Vector2(_width, _height)); _platformBody.IsStatic = true; _platformBody.Position = _position; _platformGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _platformBody, _width, _height); _platformGeom.CollisionGroup = 100; _platformGeom.CollisionGroup = _collisionGroup; _platformGeom.FrictionCoefficient = 1; }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { int count = _bottomRowBlockCount*(1 + _bottomRowBlockCount)/2; _blockBody = new Body[count]; _blockGeom = new Geom[count]; for (int i = 0; i < _blockBody.Length; i++) { _blockBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _referenceBody); _blockGeom[i] = GeomFactory.Instance.CreateGeom(physicsSimulator, _blockBody[i], _referenceGeom); view.AddRectangleToCanvas(_blockBody[i], Colors.White, new Vector2(32, 32)); } CreatePyramid(); }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { int count = _bottomRowBlockCount * (1 + _bottomRowBlockCount) / 2; _blockBody = new Body[count]; _blockGeom = new Geom[count]; for (int i = 0; i < _blockBody.Length; i++) { _blockBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _referenceBody); _blockGeom[i] = GeomFactory.Instance.CreateGeom(physicsSimulator, _blockBody[i], _referenceGeom); view.AddRectangleToCanvas(_blockBody[i], Colors.White, new Vector2(32, 32)); } CreatePyramid(); }
/* * public LoginViewModel(ILogger logger, ISignalrClient signalrClient) * { * // this.logger = logger; * // this.signalrClient = signalrClient; * loginCommand = new ActionCommand<object>(TryLogin); * } */ private void TryLogin(object parameter) { Console.WriteLine("asdasdas"); SimulatorView simulator = new SimulatorView(); simulator.Show(); //Sends the info to the server and tries a login //PasswordBox psbox = (PasswordBox)parameter; //Password = psbox.Password; //if (ValidateFields()) //{ // UserLogin userLogin = new UserLogin(Username, Password); // User loggedIn = signalrClient.TrySendLogin(userLogin).Result; // // logger.Print(loggedIn.Username); //} }
public static Simulator GetSimulator(UILogging spiderLogging, SimulatorView simulatorView, PageModel pageModel) { switch (pageModel.Type) { case SiteType.ChampsSports: return(new ChampsSportsSimulator(spiderLogging, simulatorView, pageModel)); case SiteType.Eastbay: return(new EastbaySimulator(spiderLogging, simulatorView, pageModel)); case SiteType.Footaction: return(new FootactionSimulator(spiderLogging, simulatorView, pageModel)); case SiteType.FootLocker: return(new FootLockerSimulator(spiderLogging, simulatorView, pageModel)); } return(null); }
private void Button_Click_Fly(object sender, RoutedEventArgs e) { Message = ""; int p = 0; // if the user didn't insert port and ip if (ip.Equals("") || port.Equals("")) { Message = "You need to insert IP and Port"; return; } try { p = int.Parse(this.port); } catch (Exception) { Message = "You need to insert a valid port"; return; } SimulatorView simulatorView; // Show the view. simulatorView = new SimulatorView(); simulatorView.PropertyChanged += delegate(Object s, PropertyChangedEventArgs e1) { if (e1.PropertyName.Equals("V_ConnectError") && simulatorView.V_ConnectError) { this.Message = "not connected to the simulator, try again"; } }; (Application.Current as App).Model.Run(ip, p); if (this.Message == "") { this.NavigationService.Navigate(simulatorView); check_box.IsChecked = false; } }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { _linearSpring = new LinearSpring[_rectangleCount - 1]; _rectangleBody = new Body[_rectangleCount]; _rectangleBody[0] = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _rectangleWidth, _rectangleHeight, _rectangleMass); _rectangleBody[0].Position = _position; view.AddRectangleToCanvas(_rectangleBody[0], Colors.White, new Vector2(_rectangleWidth, _rectangleHeight)); for (int i = 1; i < _rectangleBody.Length; i++) { _rectangleBody[i] = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _rectangleWidth, _rectangleHeight, _rectangleMass); _rectangleBody[i].Position = _rectangleBody[i - 1].Position + new Vector2(0, _springLength); view.AddRectangleToCanvas(_rectangleBody[i], Colors.White, new Vector2(_rectangleWidth, _rectangleHeight)); } _rectangleGeom = new Geom[_rectangleCount]; _rectangleGeom[0] = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rectangleBody[0], _rectangleWidth, _rectangleHeight); _rectangleGeom[0].CollisionGroup = _collisionGroup; for (int j = 1; j < _rectangleGeom.Length; j++) { _rectangleGeom[j] = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rectangleBody[j], _rectangleWidth, _rectangleHeight); _rectangleGeom[j].CollisionGroup = _collisionGroup; } for (int k = 0; k < _linearSpring.Length; k++) { _linearSpring[k] = SpringFactory.Instance.CreateLinearSpring(physicsSimulator, _rectangleBody[k], Vector2.Zero, _rectangleBody[k + 1], Vector2.Zero, _springConstant, _dampningConstant); } }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { int radius; if (_attachPoint == 0 | _attachPoint == 2) { radius = _rectangleHeight; } else { radius = _rectangleWidth; } //body is created as rectangle so that it has the moment of inertia closer to the final shape of the object. _angleSpringleverBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _rectangleWidth, _rectangleHeight, 1f); view.AddRectangleToCanvas(_angleSpringleverBody, Colors.White, new Vector2(_rectangleWidth, _rectangleHeight)); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _angleSpringleverBody, _rectangleWidth, _rectangleHeight); _rectangleGeom.FrictionCoefficient = .5f; _rectangleGeom.CollisionGroup = _collisionGroup; Vector2 offset = Vector2.Zero; switch (_attachPoint) { case 0: { offset = new Vector2(-_rectangleWidth/2f, 0); //offset to rectangle to left break; } case 1: { offset = new Vector2(0, -_rectangleHeight/2f); //offset to rectangle to top break; } case 2: { offset = new Vector2(_rectangleWidth/2f, 0); //offset to rectangle to right break; } case 3: { offset = new Vector2(0, _rectangleHeight/2f); //offset to rectangle to bottom break; } } _angleSpringleverBody.Position = _position - offset; CircleBrush circle = view.AddCircleToCanvas(null, Colors.White, 20); circle.Extender.Position = _position; _circleGeom = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _angleSpringleverBody, radius, 20, offset, 0); _circleGeom.FrictionCoefficient = .5f; _circleGeom.CollisionGroup = _collisionGroup; JointFactory.Instance.CreateFixedRevoluteJoint(physicsSimulator, _angleSpringleverBody, _position); SpringFactory.Instance.CreateFixedAngleSpring(physicsSimulator, _angleSpringleverBody, _springConstant, _dampningConstant); }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { //Load bodies _spiderBody = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _spiderBodyRadius, 1); _spiderBody.Position = _position; _spiderBody.IsStatic = false; view.AddCircleToCanvas(_spiderBody, _spiderBodyRadius); _leftUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _leftUpperLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X/2, 0); view.AddRectangleToCanvas(_leftUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _leftLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _leftLowerLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0) - new Vector2(_lowerLegSize.X/2, 0); view.AddRectangleToCanvas(_leftLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); _rightUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _rightUpperLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X/2, 0); view.AddRectangleToCanvas(_rightUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _rightLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _rightLowerLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0) + new Vector2(_lowerLegSize.X/2, 0); view.AddRectangleToCanvas(_rightLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); //load geometries _spiderGeom = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _spiderBody, _spiderBodyRadius, 14); _leftUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _leftLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _rightUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _rightLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _spiderGeom.CollisionGroup = _collisionGroup; _leftUpperLegGeom.CollisionGroup = _collisionGroup; _leftLowerLegGeom.CollisionGroup = _collisionGroup; _rightUpperLegGeom.CollisionGroup = _collisionGroup; _rightLowerLegGeom.CollisionGroup = _collisionGroup; //load joints JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _leftUpperLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0)); _leftShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _leftUpperLegBody); _leftShoulderAngleJoint.TargetAngle = -.4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _rightUpperLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0)); _rightShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _rightUpperLegBody); _rightShoulderAngleJoint.TargetAngle = .4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0)); _leftKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody); _leftKneeAngleJoint.TargetAngle = -_kneeTargetAngle; _leftKneeAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0)); _rightKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody); _rightKneeAngleJoint.TargetAngle = _kneeTargetAngle; _rightKneeAngleJoint.MaxImpulse = 300; }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { int radius; if (_attachPoint == 0 | _attachPoint == 2) { radius = _rectangleHeight; } else { radius = _rectangleWidth; } //body is created as rectangle so that it has the moment of inertia closer to the final shape of the object. _angleSpringleverBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _rectangleWidth, _rectangleHeight, 1f); view.AddRectangleToCanvas(_angleSpringleverBody, Colors.White, new Vector2(_rectangleWidth, _rectangleHeight)); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _angleSpringleverBody, _rectangleWidth, _rectangleHeight); _rectangleGeom.FrictionCoefficient = .5f; _rectangleGeom.CollisionGroup = _collisionGroup; Vector2 offset = Vector2.Zero; switch (_attachPoint) { case 0: { offset = new Vector2(-_rectangleWidth / 2f, 0); //offset to rectangle to left break; } case 1: { offset = new Vector2(0, -_rectangleHeight / 2f); //offset to rectangle to top break; } case 2: { offset = new Vector2(_rectangleWidth / 2f, 0); //offset to rectangle to right break; } case 3: { offset = new Vector2(0, _rectangleHeight / 2f); //offset to rectangle to bottom break; } } _angleSpringleverBody.Position = _position - offset; CircleBrush circle = view.AddCircleToCanvas(null, Colors.White, 20); circle.Extender.Position = _position; _circleGeom = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _angleSpringleverBody, radius, 20, offset, 0); _circleGeom.FrictionCoefficient = .5f; _circleGeom.CollisionGroup = _collisionGroup; JointFactory.Instance.CreateFixedRevoluteJoint(physicsSimulator, _angleSpringleverBody, _position); SpringFactory.Instance.CreateFixedAngleSpring(physicsSimulator, _angleSpringleverBody, _springConstant, _dampningConstant); }
public EastbaySimulator(UILogging spiderLogging, SimulatorView simulatorView, PageModel pageModel) : base(spiderLogging, simulatorView, pageModel) { }
public ChampsSportsSimulator(UILogging spiderLogging, SimulatorView simulatorView, PageModel pageModel) : base(spiderLogging, simulatorView, pageModel) { }
public FootactionSimulator(UILogging spiderLogging, SimulatorView simulatorView, PageModel pageModel) : base(spiderLogging, simulatorView, pageModel) { }
public void Load(SimulatorView view, PhysicsSimulator physicsSimulator) { //Load bodies _spiderBody = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _spiderBodyRadius, 1); _spiderBody.Position = _position; _spiderBody.IsStatic = false; view.AddCircleToCanvas(_spiderBody, _spiderBodyRadius); _leftUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _leftUpperLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X / 2, 0); view.AddRectangleToCanvas(_leftUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _leftLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _leftLowerLegBody.Position = _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0) - new Vector2(_lowerLegSize.X / 2, 0); view.AddRectangleToCanvas(_leftLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); _rightUpperLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _upperLegSize.X, _upperLegSize.Y, 1); _rightUpperLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X / 2, 0); view.AddRectangleToCanvas(_rightUpperLegBody, Colors.White, new Vector2(_upperLegSize.X, _upperLegSize.Y)); _rightLowerLegBody = BodyFactory.Instance.CreateRectangleBody(physicsSimulator, _lowerLegSize.X, _lowerLegSize.Y, 1); _rightLowerLegBody.Position = _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0) + new Vector2(_lowerLegSize.X / 2, 0); view.AddRectangleToCanvas(_rightLowerLegBody, Colors.Red, new Vector2(_lowerLegSize.X, _lowerLegSize.Y)); //load geometries _spiderGeom = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _spiderBody, _spiderBodyRadius, 14); _leftUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _leftLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _leftLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _rightUpperLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightUpperLegBody, _upperLegSize.X, _upperLegSize.Y); _rightLowerLegGeom = GeomFactory.Instance.CreateRectangleGeom(physicsSimulator, _rightLowerLegBody, _lowerLegSize.X, _lowerLegSize.Y); _spiderGeom.CollisionGroup = _collisionGroup; _leftUpperLegGeom.CollisionGroup = _collisionGroup; _leftLowerLegGeom.CollisionGroup = _collisionGroup; _rightUpperLegGeom.CollisionGroup = _collisionGroup; _rightLowerLegGeom.CollisionGroup = _collisionGroup; //load joints JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _leftUpperLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0)); _leftShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _leftUpperLegBody); _leftShoulderAngleJoint.TargetAngle = -.4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _spiderBody, _rightUpperLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0)); _rightShoulderAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _spiderBody, _rightUpperLegBody); _rightShoulderAngleJoint.TargetAngle = .4f; _leftShoulderAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody, _spiderBody.Position - new Vector2(_spiderBodyRadius, 0) - new Vector2(_upperLegSize.X, 0)); _leftKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _leftUpperLegBody, _leftLowerLegBody); _leftKneeAngleJoint.TargetAngle = -_kneeTargetAngle; _leftKneeAngleJoint.MaxImpulse = 300; JointFactory.Instance.CreateRevoluteJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody, _spiderBody.Position + new Vector2(_spiderBodyRadius, 0) + new Vector2(_upperLegSize.X, 0)); _rightKneeAngleJoint = JointFactory.Instance.CreateAngleJoint(physicsSimulator, _rightUpperLegBody, _rightLowerLegBody); _rightKneeAngleJoint.TargetAngle = _kneeTargetAngle; _rightKneeAngleJoint.MaxImpulse = 300; }