dyn4j | Java Collision Detection and Physics Engine | Game Engine library
kandi X-RAY | dyn4j Summary
kandi X-RAY | dyn4j Summary
Java Collision Detection and Physics Engine
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Evaluates the velocity constraints .
- Decomposes a polygon to a list of polygons .
- Solves the to - II collision .
- Balances the balance of a node .
- Returns a list of y - monotone polygons .
- Removes a node from the tree .
- Initializes a priority queue for a set of points .
- Computes the maximum distance of an ellipse .
- Creates a polygonal circle with the specified caps width and height .
- Merges the convex hull .
dyn4j Key Features
dyn4j Examples and Code Snippets
Community Discussions
Trending Discussions on dyn4j
QUESTION
My java application requires a 2d physics engine for a horizontal world, however, looking at jbox2d and dyn4j, it seems that they don't offer what I need out-of-the-box. Specifically, they don't support defining which object groups can collide with others. Consider this simplified model: Bullets can collide with boxes. Planes pass through boxes, but they can collide with bullets.
How do I exclude certain groups of objects from colliding in a physics engine?
...ANSWER
Answered 2018-May-07 at 06:41There is a solution in box2d (and jbox2d respectively). The "PreSolve" method allows to disable a contact before colliding. See this question on gamedev which has pretty much the same problem as described here.
From documentation:
Pre-Solve Event
This is called after collision detection, but before collision resolution. This gives you a chance to disable the contact based on the current configuration. For example, you can implement a one-sided platform using this callback and calling b2Contact::SetEnabled(false). The contact will be re-enabled each time through collision processing, so you will need to disable the contact every time-step. The pre-solve event may be fired multiple times per time step per contact due to continuous collision detection.
QUESTION
I'm writing some code in C++ for testing collisions using the separating axis theorem and in certain orientations it wrongly triggers that there is a collision occurring
I'm following this tutorial, however the tutorial is only in 2D and i'm trying to implement it in 3D although i think it should still be the same.
The algorithm that i have now doesn't miss any collisions but for some orientations of the two boxes it thinks that that are colliding when they're infact not. An example can be seen here, these two boxes are apparently colliding according to the code below.
The code is written in C++
BoxCollider.h
...ANSWER
Answered 2018-Dec-15 at 19:00tutorial is only in 2D and i'm trying to implement it in 3D although i think it should still be the same
Unfortunately, it is not the case. The 3D case a little bit more complex. To check whether two complex shapes are colliding in 3D, you need to check every face normal (you do this), and directions which are perpendicular to an edge of each object (you miss these).
So, for boxes (A and B), with edge directions A0, A1, A2, and B0, B1, B2, we have:
- 3 normals of A
- 3 normals of B
- 9 directions: A0 x B0, A0 x B1, A0 x B2, A1 x B0, A1 x B1, A1 x B2, A2 x B0, A2 x B1, A2 x B2
So you just need to add the missing 9 checks.
Further note: you don't need to swizzle the normals. I mean this line is not needed:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dyn4j
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page