snowkit / differ Goto Github PK
View Code? Open in Web Editor NEWA separation axis theorem collision library for Haxe.
Home Page: https://snowkit.github.io/differ/
License: MIT License
A separation axis theorem collision library for Haxe.
Home Page: https://snowkit.github.io/differ/
License: MIT License
There's no reason to test a collision if the source (shape1) is not moving.
One way would be to set a boolean whenever there's a change to x/y/rotation. Not sure if there are other accessors for the user. Will check.
I've used differ very naively in my project, with every tilemap tile having it's own box collider, and with every collision check checking all of these tiles. It's bad - and I'll fix it with a quad tree or something - but the JS export of my project has been working fine, not lagging at all. However, when I export for windows (I'm using Kha) the app can't run, and after just seconds will freeze and close. I think this performance difference is due to differ, as when running the windows build through visual studio, the performance tools reported that 81.53% of my builds CPU time was spent on a differ method.
Feel free to close this if this is outside's of differs control. I totally get that this sort of performance should be expected with what I am doing. I'm just almost curious about why JS does work well, when I expected C++ performance to be higher.
Hi. What is the license for this library?
The best implementation we discussed was a simple custom container that keeps a set of preallocated results.
You'd create one with a fixed size to start, then upon use, it resets each as it populates them. It keeps track of how many are set in the length property, then it can be iterated normally and the length property will correctly reflect the number of valid results, as well as correctly respond to [ ]
operator.
This is the last place needing an into
argument, which the type of would be this container.
Polygon vs Polygon is ok,
Polygon vs Circle has odd behavior (see test case nme project).
Let's just use something else :)
When using the scaleX and scaleY properties, polygons seems to be incorrectly transformed. When examining transformed vertices of a polygon, it appears that scale transformation is applied for both X and Y, even when only one of the scaleX/Y properties are used.
So, when using myPolygon.scaleX = 0.5; scale is set to {0.5, 1}.
When using myPolygon.scaleY = 0.5; scale is actually set to {0.5, 0.5} but applied to the transformation matrix twice.
Also, like #8, would be best with more than just true or false
Polygon.create([a1, b1, a2, b2...]) and another name for perfect polygon types by number of sides would make more sense.
Triangle.create() could be nice too.
In demo 1 for instance, all I see is
Click to toggle using the polygon, or using the circle. See https://github.com/underscorediscovery/hxcollision for code
Haxe version: 4.0.5
/Users/dkuffner/games/haxe/celest-hl/.haxelib/differ/1,3,0/differ/shapes/Circle.hx:12: characters 24-34 : radius: Custom property accessor is no longer supported, please use `get`
/Users/dkuffner/games/haxe/celest-hl/.haxelib/differ/1,3,0/differ/shapes/Circle.hx:14: characters 35-56 : transformedRadius: Custom property accessor is no longer supported, please use `get`
as the tile says.
this is just setting it up as normal, nothing has actually been put in apart from imported
I'm using a raycast with infinite turned off, but the raycast is hitting shapes behind me.
For example, I have a square in the middle of the room. If I'm on the right hand side of the square and face left, I hit the outside of the square the the raycast works. If I face right, the raycast now comes in from (what seems like) infinite distance away from the left and hits the square from the left side.
Facing towards the square:
https://dl.dropboxusercontent.com/u/20830426/differ_facingtoward.png
Facing away from the square:
https://dl.dropboxusercontent.com/u/20830426/differ_facingaway.png
It seems like you can replicate this in the github demo by moving the mouse past the raycaster on the left hand side:
https://dl.dropboxusercontent.com/u/20830426/differ_demobug.png
Is this a bug or a settings issue?
Here's an example of the Luxe platformer having its gravity reverted (gravity.set_xyz(0, -800, 0);
in Simulation.hx
).
The rectangles of the two colliders have exactly the same y-coordinates but appears to block the players movement along the x-axis.
This might be caused by the gravity being applied causing the calculations of the player to be performed in this position -- where he actually would be blocked by the other collider.
Any fix or workaround?
If I set shape.rotation = 45, the shape rotates each time I update the value instead of keeping it at 45ΒΊ
When a circle shape is positioned at the start of a non-infinite ray, there is no collision detected by testRayVsCircle
function. I believe this is non-intentional?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.