Coder Social home page Coder Social logo

box2d-delphi's People

Contributors

wqyfavor avatar

box2d-delphi's Issues

Box2D-GR32 Cloth simulation

转自:
http://graphics32.org/news/newsgroups.php?
art_group=graphics32.general&article_id=10440

I have done a cloth simulation using Box2D and Graphics 32. It works pretty
well when drawing the cloth using splines and circles (for the cloth grid
nodes). It's also quite effective at filling the cloth with a bitmap image
and TBitmapPolygonFiller.

One thing that doesn't work properly or only half-works is projective
mapping of the bitmap image onto the cloth grid using
TProjectiveTransformation. This could be to do with my code, but it's more
likely to do with the fact that TProjectiveTransformation doesn't handle
non-convex rectangles. I see now why this kind of application (mapping
bitmaps onto animated shapes) is usually done with triangles -- you can't
have a non-convex triangle.

The source is available at:

http://www.anti-philosophy.co.uk/graphics/box2dclothsrc.zip

This uses GR32, Delphi Box2D V2.1, and VPR. The necessary Box2D files are
included in the source folder, but you are strongly recommended to at least
take a look at the full Delphi Box2D package (and its extensive suite of
demo programs using OpenGL). The author of the Delphi port has recently
converted the latest version of Box2D and has also added several highly
impressive new controllers for simulating explosions, ropes, and wind. I've
added a Spring controller which is included in the source for the Cloth
demo.

The full Delphi Box2D package is at

http://sourceforge.net/projects/box2d-delphi/

You can download a compiled version (500k) of the demo from:

www.anti-philosophy.co.uk\graphics\box2dclothtest.zip

See Readme.txt for instructions.

I am sure the projective mapping code can be improved and it may also be
possible to fix it to work with non-convex rectangles. The other solution
would be to adapt TProjectiveTransformation for triangles. I hope somebody
does take a look at the code and suggests improvements (I am off on holiday
from Monday so if anyone does take the project further I won't be able to 
respond
until May 10th).

Simon

Original issue reported on code.google.com by [email protected] on 4 May 2010 at 1:31

Box2D Delphi demos

In addition to the Box2d Cloth test, a year or so ago I also did three programs 
demonstrating other applications of Box2d with Delphi.

box2dplayground.zip
box2dplaygroundiii.zip
box2dplayground05.zip

I can't remember exactly what the differences are in these programs, but I 
think the last one uses Bass.dll to add sound.

Download them from www.anti-philosophy.co.uk/graphics, e.g.:

http://www.anti-philosophy.co.uk/graphics/box2dplaygroundiii.zip

Original issue reported on code.google.com by [email protected] on 23 Oct 2011 at 8:43

accessing freed object

procedure Tb2World.DestroyJoint(j: Tb2Joint);
...
   //b2Assert(m_jointCount > 0);
   Dec(m_jointCount);
   j.Free; // <<<<< "j" is freed

...
   if not collideConnected then
   begin
      edge := j.m_bodyB.GetContactList;
      while Assigned(edge) do
      begin
         if edge^.other = j.m_bodyA then // <<<<<<< use "j"

Original issue reported on code.google.com by [email protected] on 23 Apr 2010 at 2:06

fixed body joint + fixed rotation

What steps will reproduce the problem?
1. create few bodies with fixed rotation
2. make fixed joints for this bodies

What is the expected output? What do you see instead?
all simulation stuck`s

What version of the product are you using? On what operating system?
2.1.3

Original issue reported on code.google.com by [email protected] on 23 Dec 2010 at 6:33

A Patch to improve 64-bits in both Delphi and FPC

This is a patch to improve compatibility with FreePascal (specially the new 
compatibility feature to support records with overloaded methods introduced 
with version 2.6.0) and 64-bit in both Delphi and FreePascal with new 64-bit 
compatible assembly.

Original issue reported on code.google.com by [email protected] on 8 Nov 2011 at 10:23

Attachments:

Free Pascal support

Do you plan to add support for Free Pascal?  I downloaded the 2.3 package, 
modified the MSTimer unit, and got the demo running, but collisions are all 
handled wrongly - both colliding objects either disappear, or go out of bounds.

Thanks.

Original issue reported on code.google.com by [email protected] on 27 Apr 2012 at 8:02

NAN-crash, using Tb2BuoyancyController

function Tb2CircleShape.ComputeSubmergedArea(const normal: TVector2; 
offset: Float;
   const xf: Tb2Transform; var c: TVector2): Float;
var
   p: TVector2;
   l, r2, l2, com: Float;
begin
   p := b2Mul(xf, m_p);
   l := -(b2Dot(normal, p) - offset);

   if l < -m_radius + FLT_EPSILON then
   begin
      Result := 0.0; // Untouch
      c.x := 0; // <<<<<< maybe we should reset "c"?
      c.y := 0;
      Exit;
   end;

   r2 := m_radius * m_radius;
   if l > m_radius then
   begin
      //Completely wet
      c := p;
      Result := Pi * r2;
   end;

   if l > m_radius then l := m_radius; // <<<<< Sqrt and ArcSin function 
retrun NAN if l > m_radius, can be bigger than m_radius, than this method 
will return NAN and all physics became crashed, i`ve got this situation 
when use Tb2BuoyancyController

   //Magic
   l2 := l * l;

   Result := r2 *(ArcSin(l / m_radius) + Pi / 2) + l * Sqrt(r2 - l2);
   com := -2 / 3 * Power(r2 - l2, 1.5) / Result;

   c.x := p.x + normal.x * com;
   c.y := p.y + normal.y * com;
end;

Original issue reported on code.google.com by [email protected] on 23 Apr 2010 at 2:10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.