Giter VIP home page Giter VIP logo

nape's Introduction

Where to download

Available on github are the .cx source-code requiring my caxe preprocessor.

From the Nape website (http://napephys.com) are available the the AS3 .swcs, manuals, samples and documentation.

From haxelib, you can also install nape with 'haxelib install nape' or when updating, 'haxelib upgrade'.

Building from source

The supplied Makefile should work fine under *nix systems, commands will be near identical from windows command line, though mingw is probably easiest approach. Caxe will have to be built also, and compiling swcs requires my flib tool.

nape's People

Contributors

deltaluca avatar gama11 avatar ibwwg avatar leolannenmaki avatar meduzik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nape's Issues

Handling compound bodies in collision detection.

We all know the issue, colliding against 'inner' edges.

Continous collision detection will greatly help reduce this problem, but it will remain a problem even then.

I have tried various complex solutions that remain effecient as extensions to SAT, but none have worked. Worse, they have made somethings even worse so that they absolutely cannot be used as any partial-solution should not regress behaviour.

nape swcs routinely cause exceptions in apparat

java.util.zip.ZipException: invalid entry compressed size (expected 12227 but got 12225 bytes)
at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:391)
at java.util.zip.ZipInputStream.read(ZipInputStream.java:156)
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78)
at apparat.swc.Swc.extract(Swc.scala:111)
....

is there a known issue with the way haxe zips swcs? could you do something about it? I am currently re-packing these swcs by hand :(

No collisions in JS

When I upgraded to Haxe 2.10, body collisions in Nape mysteriously stopped working in my JS demo: https://aduros.com/flambe/demos/physics/?flambe=html (Click to spawn objects, and compare with the working Flash version)

Here's a debug build that throws a Nape assertion: https://aduros.com/tmp/physics-debug/?flambe=html. When I go back to Haxe 2.09 or compile without --dead-code-elimination, it works once again.

I think the root cause is Haxe 2.10 modified the JS output to not include members in the prototype by default under DCE. Previously an uninitialized member variable would have been null, now it's undefined. Undefined has slightly different semantics in JS than null when casting to a number. (ie, Math.floor(null) != Math.floor(undefined))

The source for this test case is at https://github.com/aduros/flambe-demos/tree/master/physics if it helps. Thanks!

runtime defined general constraints?

Investigate possibility of having truly general constraints, scriptable in some way without the need for complex deriviations (so of course they would not have the same performance as hard-wired constraints).

maybe i'm just dreaming.

GeomPoly: aabb

What about bb for GeomPoly? I think it would be helpful. For me, exactly ;)

General linear constraint.

alla old nape, pulley joint being a special case of this constraint.

The deriviation is already done, but the implementation (and it's complexities compared to pair-wise constraints) is not.

Allow zero density shapes.

For the purposes of allowing pure sensor shapes as part of a larger Body, should allow density to be zero on Material's with the restriction that zero 'mass' Body's must not be allowed as this would simple break physics.

Make allowances for multiple concurrent Space's

Technically a minor bug, but of 'low' importance since I've never come across anyone actually 'wanting' to have more than one Space in execution at once.

There are a few places where nape does not technically work properly with multiple concurrent Spaces.

One such place is at present in the way CbType's are managed, in that they will record all listeners associated, but no checks are made to make sure the listeners actually used from the CbType in the Space are 'for' this Space. it is simply assumed that they will be.

Other such occurences may exist.

GeomPoly: vertices iterator

please add iterator for vertices in GeomPoly. Now I use copy(), current() and pop() to iterate all vertices in GeomPoly

Continous collision detection.

Whether it be conservative advancement alla box2d, or simpler swept SAT ignoring rotations.

advantages of swept SAT being better speed and should not need things like shrunken shapes which in box2d force you to have polygons satisfy certain properties which would really be annoying for things like the convex decompositions!

swept SAT should be enough to avoid tunnelling in most circumstances.

Add something to the API to allow forced sleeping of bodies.

Use case in large worlds to allow areas to be sleeping immediately at start that are no-where near a player.

I would personally prefer to simply not 'add' the bodies, but I guess this is a bit more automatic.

Not sure what API should exist for this... allow body/constraint.sleeping to be mutable? Probably.

Handling compound bodies w.r.t. to fluid drag.

Issue right now w.r.t to compound bodies with shapes that overlap or join together with implicit 'inner' edges, issue being that there will be too much drag!

Not sure of a general solution to this problem, it should not be something that is come across all too often, with a work around being to reduce the fluid friction on these bodies specifically.

Small bug in splice_collinear of PR(Polygon).

Doesn't seem to handle start vertex being one of the vertices to be removed:

Test case:

package;
$(import);

class DummyNapeMain {
    static function main() {
        var space = new Space();

        var tris = new Body(BodyType.STATIC);
        tris.shapes.add(new Polygon([
            new Vec2(0,200), new Vec2(50,250), new Vec2(100,300), new Vec2(50,300), new Vec2(0,300), new Vec2(0,250)
        ]));
        tris.shapes.add(new Polygon([
            new Vec2(250,250), new Vec2(300,200), new Vec2(300,250), new Vec2(300,300), new Vec2(250,300), new Vec2(200,300)    
        ]));
        tris.space = space;

        var debug = new ShapeDebug(1,1);
        flash.Lib.current.addChild(debug.display);

        for(i in 0...11) {
            var b = new Body();
            b.shapes.add(new Circle(4));
            b.position.x = 300/10*i;
            b.space = space;
            b.velocity.y = 100;
        }

        (new haxe.Timer(11)).run = function() {
            debug.clear();
            space.step(1/60,10,10);
            debug.draw(space);
        }
    }
}

Abstract internal lists selectively to use arrays or linked lists.

For flash, linked lists remain the more performant type for use in nape, however for c++ and perhaps other targets, Arrays win the performance bet.

A way to selectively abstract the lists to use an array where possible for c++ and other targets would be good to get a bit better performance, and perhaps futureproof nape should arrays/vector gain performance in flash.

GeomPoly.push error

It seems what GeomPoly.push add point to the beggining of list

simple exemple:

for each (var point:Point in vertices)
{
trace("push point", Vec2.fromPoint(point).toString());
poly.push(Vec2.fromPoint(point));
}

var geomVertexIterator:GeomVertexIterator = poly.iterator();
var traceStr:String = "";
while (geomVertexIterator.hasNext())
traceStr += geomVertexIterator.next().toString() + ",";
trace(traceStr);

trace output:

push point { x: -200 y: 200 }
{ x: -200 y: 200 },
push point { x: -200 y: -200 }
{ x: -200 y: -200 },{ x: -200 y: 200 },
push point { x: 200 y: -200 }
{ x: 200 y: -200 },{ x: -200 y: 200 },{ x: -200 y: -200 },
push point { x: 200 y: 200 }
{ x: 200 y: 200 },{ x: -200 y: 200 },{ x: -200 y: -200 },{ x: 200 y: -200 },

Callbacks for interactions.

Progress has finally begun on this area of nape (callb branch).

By the end should have begin;ongoing;end callbacks between shapes-bodies, bodies-bodies and shape-shapes as well as immediate callbacks to complement masking as per old-nape.

Proper documentation.

Right now apart from the API docs and a few scattered examples there is not really any documentation for new nape.

PivotJoint broken in ad-hoc iOS build using Nape swc

Hey, Luca! Here it is, report about broken PivotJoint in the ad-hoc packaged iOS app)

Please, feel free to compile this sources both for desktop and mobile (using ad-hoc packaging):
http://codestage.ru/dump/nape/Nape_bug.zip

You should see one PivotJoint is broken and the bottom girder swings on one working PivotJoint left in ad-hoc build and how girder is fixed by two PivotJoints on desktop.

The broken PivotJoint is created at Hole.initObj();

Looks like it's another Adobe iOS packager issue, like it was with callbacks recently =(

Body groups.

alla old nape 'Group', provide a grouping of bodies (constraints also?) for the purposes of interaction callbacks and complementing masking for interaction control.

Cannot compile demos

Hi =),

I'm trying to compile the demos, but some classes are missing from the sources.
For example with the WaterBalls demo:
FixedStep
FPS
nape.phys.BodyType
nape.util.BitmapDebug

I see that BodyType and BitmapDebug classes are present in the haxe fp10 debug swf, but cannot be found on the source files,
and for FixedStep and FPS, I don't know where they come from.

I'm trying to compile with flashdevelop. Did I missed something ?

Thank you in advance for your help ! =)
Anthony

ASC2 throw 100 warnings

swc release build Milestone 10.1 r15 will throw around 100 warnings via ASC2 in my FB4.7 AIR3.4 e.g.

The definition getClass.T depended on by Type in the SWC release_nape_10.1_r15.swc could not be found

The definition Null.T depended on by flash.Boot in the SWC release_nape_10.1_r15.swc could not be found

The definition Null.T depended on by nape.callbacks.CbTypeList in the SWC release_nape_10.1_r15.swc could not be found

and other 100 warnings about "Null.T"

i'm try asking adobe about this and here is the answer

That release_nape.swc’s catalog.xml does not appear to have been constructed correctly (it looks like it was created by Haxe). Those warnings are real - the defintions in catalog.xml say they have a dependency on a type "T" in a package "Null", but the compiler can’t find it.

The maker of Haxe might have a "built-in" SWC somewhere to provide this definition?

If not, and if the type is not used at runtime, you could for now hack in a Null/T.as source file (and any other missing definition) as an empty class definition to suppress the linkage error, though it would be better if Haxe could correct the catalog.xml in such SWCs.

please advice

GeomPoly toString

var obj:GeomPoly;
..........
trace(obj); // GeomPoly[,{100,100}{0,0},{100,0}]
(first comma improperly in my trace)

(inline-docs branch). Reminder.

Test case:

box, sitting on ground (Asleep).
box, colliding continuously hits the sleeping box.

Verify that A) a begin event is created for continuous collision
Verify that B) the objects woken by continuous collision, have their ongoing events created.

Replacing hashes wherever possible with alternative

Recently a hash for arbiters in Space, and one for shape-pairs in dyn-aabb broadphase were removed, which together results in a 10mb memory usage decrease and no measurable performance detriment in the stress-pyramid demo.

There are further hashes for which I should try and replace them either with an alternative, or at worst an RBTree when applicable (for which an implementation already exists).

simple_decomposition internal error

Pure as3 project

var geomPoly:GeomPoly = new GeomPoly(newVertices);
if (!geomPoly.isSimple())
simpleGeomPolyList = geomPoly.simple_decomposition();

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at zpp_nape.util::ZPP_Set_ZPP_SimpleVert/remove_node()
at zpp_nape.geom::ZPP_Simple$/clip_polygon()
at zpp_nape.geom::ZPP_Simple$/decompose()
at nape.geom::GeomPoly/simple_decomposition()

duplicate listener bug

adding same listener twice causes some bug to form. either silently permit it, or give an error. probably first since it's trivial.

Runtime defined, symbolically defined constraints.

new symbolic branch; at a further stage and better implemented from previous symbolic branch.

Goal (hahaha) is to have:

  1. constraints specified via a runtime string not done,
  2. using symbolic algebra to compute velocity constraints, jacobian and effective masses done, needs improvement
  3. producing executable hscript scripts partially done, rubbish output at present
  4. to execute the expressions at runtime in a UserConstraint not done
  5. allowing output to be made visible so that an effecient implementation may be made later by hand.

The benefits of this would be being able to rapidly test user-constraint's, albeit a final version would still need to be hand-written for performance.

That and it's fun.

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.