Questions tagged [nape]

Nape is a powerful, fast, and friendly 2D Rigid Body physics engine for AS3/Haxe. Nape is open-source and free to use for personal and commercial projects.

Nape is a 2D rigid body physics engine designed for games, written in Haxe, and supporting all Haxe targets. Nape is compiled into .swc libraries for AS3 users.

Nape is higher performing than Box2D solutions in AS3/Haxe, and its memory usage is stable and far less than Box2D. Nape supports the majority of Box2D features, as well as many features not included in Box2D such as the geometric utilities, the high-level callbacks system, and more sophisticated buoyancy.

28 questions
4
votes
1 answer

sensorGroup and sensorMask combination for ships and bullets in Nape

I have multiple spaceships (SHIP_CB CbType), that can all shoot missiles (BULLET_CB CbType). How do I set up there sensorGroup, sensorMask and InteractionListeners so I get the following behaviour: Ships all collide and bounce off each…
Adam Harte
  • 9,820
  • 7
  • 48
  • 82
2
votes
1 answer

How to move a HaxeFlixel FlxNapeSprite?

I'm trying to use Nape with HaxeFlixel. Sadly, there's almost no documentation on how to use the addons.nape package and I just can't figure out why this code isn't moving the white rectangle (_test). (I left out imports for simplicity) class…
JaytleBee
  • 38
  • 5
2
votes
1 answer

Impulse a Nape body in direction to a specific position

I have a sleep body I want to apply an impulse in direction to a specific x/y position, let's say x:200, y:300. But when this impulse is applied the body moves in direction to the x/y but not to the exactly position, it has a difference range around…
Chris
  • 1,739
  • 1
  • 13
  • 22
2
votes
3 answers

How to connect Haxe project with Nape

I have a src folder, containing a Main.hx & compile.hxml. I run the command sudo haxelib install nape, which reported it ended successfully installing Nape 2.0.5. In the Main.hx I posted the code from this page, and then I run haxe compil.hxml which…
mirandalol
  • 445
  • 1
  • 6
  • 16
1
vote
0 answers

Nape Physics: Collision issue (moving across tiles)

There is a character, when moved across one tile to another sometimes the character either jumps over the meeting point of the tile polygons or becomes completely stuck and can no longer move in the direction they were going until they take a step…
1
vote
0 answers

How to put to sleep the non-visible part of your map?

I'm creating a level modifying slightly the destructible terrain class from here: http://napephys.com/samples.html#swf-DestructibleTerrain Instead of using PerlinNoise to create a random map, I input my own bitmapdata. When the size of the terrain…
Artemix
  • 7,979
  • 13
  • 45
  • 74
1
vote
1 answer

FlxNapeSprite and collisions

I'm using Nape Physics with the dev version of HaxeFlixel. I have a few FlxNameSprites moving around in my game. Nape's own handling of collision resolution is excellent, but how do I make my own code react to the collisions happening too? I.e if…
Piku
  • 3,286
  • 6
  • 32
  • 38
1
vote
1 answer

Nape - Keeping the same physics behaviour over different screen sizes

Im wondering how to keep the same physics behaviour over different screen sizes? For example, i have a wheel fixed on the middle of the stage. I have a mouse pivot joint that i use to spin the wheel. The radius of the wheel depends on the screen…
deloki
  • 1,603
  • 2
  • 18
  • 26
1
vote
1 answer

HaxeFlixel. Nape. DistanceJoint debugging. Drag sprite to area

I have a sprite that I can drag around on screen. I want to be able to drag this sprite into an area (box). As it stands now I can only drop the sprite into the box, but when I drag it directly inn, the program crashes. I have debugged in…
ibliso
  • 33
  • 4
1
vote
1 answer

Object not falling

I created a space where there is gravity and two objects: var napeWorld:Space=new Space(new Vec2(0,500)); var ground:FlxNapeSprite = addBox(320, 480, 640, 20, BodyType.STATIC, FlxColor.BLUE); var hero=addBox(320,60,20,20,BodyType.DYNAMIC,…
Martin Delille
  • 9,399
  • 11
  • 55
  • 118
1
vote
1 answer

Nape physics. How to listen to SLEEP event of the space/world?

How should I set a single callback which would trigger when there is no motion in the Space of Nape, when each body "goes to sleep"? I couldn't find any proper solution for this, but I guess this is a must-have for a physics engine. Thank you.
momijigari
  • 1,578
  • 2
  • 14
  • 26
1
vote
1 answer

Body and Sprite Positions

When I compile my hero doesn't touch the floor but stops anyways a few pixels above. I figured if I traced both bodies and their respective sprites I'd know which ones aren't coincinding. trace("Hero: ", hero.position.y, "/",…
RAO
  • 61
  • 1
  • 12
0
votes
1 answer

How do I convert these Haxe source files to Python?

I am trying to port the Nape physics engine (written in Haxe) to a language not supported by Haxe (Xojo). Now I don't understand Haxe but I am comfortable in Python. I'm trying to convert the mass of .hx files to python source files so I can then…
Garry Pettet
  • 7,482
  • 22
  • 60
  • 97
0
votes
0 answers

Nape bodyList ignores bodies

I have 13 bodies on the nape space (5 static and 8 dynamic), when i loop through bodylist to remove dynamic bodies, the loop reads only 9 bodies(5 static and 4 dynamic)and ignores the 4 other dynamic however the bodylist length gives me 13 when…
0
votes
1 answer

[AS3][Nape Physics] How to access associated object of a Nape body in a InteractionListener?

I need help with the physics engine Nape in AS3. I have a class with some rectangles (Nape bodies) as member variables. I have a InteractionListener that reacts when these rectangles interacts with some circles (also Nape bodies) in the scene.…
user1066278
  • 330
  • 1
  • 6
  • 16
1
2