public virtual void OnMouseRightButtonUp(Vect chipmunkDemoMouse) { }
public virtual void OnMouseMove(Vect chipmunkDemoMouse) { }
public override Space LoadContent() { space = ChipmunkDemoGame.CreateSpace(); space.Gravity = new Vect(0, -600); _kinematicBoxBody = new Body(BodyType.Kinematic); space.AddBody(_kinematicBoxBody); _kinematicBoxBody.AngularVelocity = 0.4; // Set up the static box. var a = new Vect(-200, -200); var b = new Vect(-200, 200); var c = new Vect(200, 200); var d = new Vect(200, -200); Shape shape = new Segment(_kinematicBoxBody, a, b, 0.0); space.AddShape(shape); shape.Elasticity = 1.0; shape.Friction = 1.0; shape.Filter = ChipmunkDemoGame.NotGrabbableFilter; shape = new Segment(_kinematicBoxBody, b, c, 0.0); space.AddShape(shape); shape.Elasticity = 1.0; shape.Friction = 1.0; shape.Filter = ChipmunkDemoGame.NotGrabbableFilter; shape = new Segment(_kinematicBoxBody, c, d, 0.0); space.AddShape(shape); shape.Elasticity = 1.0; shape.Friction = 1.0; shape.Filter = ChipmunkDemoGame.NotGrabbableFilter; shape = new Segment(_kinematicBoxBody, d, a, 0.0); space.AddShape(shape); shape.Elasticity = 1.0; shape.Friction = 1.0; shape.Filter = ChipmunkDemoGame.NotGrabbableFilter; double mass = 1; double width = 30; double height = width * 2; // Add the bricks. for (int i = 0; i < 7; i++) { for (int j = 0; j < 3; j++) { var pos = new Vect(i * width - 150, j * height - 150); int type = random.Next(3000) / 1000; if (type == 0) { AddBox(pos, mass, width, height); } else if (type == 1) { AddSegment(pos, mass, width, height); } else { AddCircle(pos + new Vect(0.0, (height - width) / 2.0), mass, width / 2.0); AddCircle(pos + new Vect(0.0, (width - height) / 2.0), mass, width / 2.0); } } } return(space); }
/// <summary> /// Method called when a process token executes the step. /// </summary> public ExitType Execute(IStepExecutionContext context) { IState _timenow = _propTimenow.GetState(context); double timenow = Convert.ToDouble(_timenow.StateValue); // Example of how to get the value of a step property. SerializarElement sr = new SerializarElement(); if (File.Exists(sr.SerializationFile)) { Vect v = sr.deserializa(); vectores = sr.deserializa(); vectores.MipYc = v.MipYc; vectores.MipYv = v.MipYv; vectores.MipTc = v.MipTc; vectores.MipTv = v.MipTv; vectores.PlYc = v.PlYc; vectores.PlYv = v.PlYv; vectores.PlTc = v.PlTc; vectores.PlTv = v.PlTv; vectores.PlTcmalo = v.PlTcmalo; //Dinamico vectores.Din1 = v.Din1; vectores.DesCam = v.DesCam; vectores.Fila = v.Fila; //LP vectores.TCV = v.TCV; vectores.TCC = v.TCC; vectores.TCj = v.TCj; vectores.TDi = v.TDi; vectores.Destij = v.Destij; vectores.Dj = v.Dj; vectores.Uj = v.Uj; vectores.Ui = v.Ui; vectores.RLi = v.RLi; vectores.RUi = v.RUi; vectores.Mine = v.Mine; vectores.Mineralocado = v.Mineralocado; } int periodos = 13 - Convert.ToInt32(Math.Truncate(timenow)); for (int b = 0; b < 21; b = b + 1) { for (int a = 0; a < 31; a = a + 1) { vectores.PlYc[a, b] = vectores.MipYc[a, b, periodos]; vectores.PlYv[a, b] = vectores.MipYv[a, b, periodos]; vectores.PlTc[a, b] = vectores.MipTc[a, b, periodos]; vectores.PlTv[a, b] = vectores.MipTv[a, b, periodos]; } } return(ExitType.FirstExit); }
/// <summary> /// Calculate the area of a segment, assuming a thickness has been provided. The area is /// calculated assuming the endpoints would be rounded, like a capsule. /// </summary> public static double AreaForSegment(Vect a, Vect b, double radius) { return(NativeMethods.cpAreaForSegment(a, b, radius)); }
/// <summary> /// Calculate the moment of inertia for the line segment. /// </summary> public static double MomentForSegment(double mass, Vect a, Vect b, double radius) { return(NativeMethods.cpMomentForSegment(mass, a, b, radius)); }
/// <summary> /// Let Chipmunk know about the geometry of adjacent segments to avoid colliding with endcaps. /// </summary> public void SetNeighbors(Vect prev, Vect next) { NativeMethods.cpSegmentShapeSetNeighbors(Handle, prev, next); }
/// <summary> /// Create a line segment. /// </summary> /// <param name="body">The body to attach the segment to.</param> /// <param name="a">The first endpoint of the segment.</param> /// <param name="b">The second endpoint of the segment.</param> /// <param name="radius">The thickness of the segment.</param> public Segment(Body body, Vect a, Vect b, double radius) : base(NativeMethods.cpSegmentShapeNew(body.Handle, a, b, radius)) { }
/// <summary> /// Change the offset of the circle shape. /// </summary> public static void SetOffset(this Circle circle, Vect offset) { NativeMethods.cpCircleShapeSetOffset(circle.Handle, offset); }