Basic dynamic 3D collision in LWJGL - java

sorry about my last question it was a bit all over the place.
I have hit a huge road block with a game I am coding for a friend and i need to learn dynamic collision. A tutorial would be great, a very basic one and i have already seen the NeHe collision detection tutorial and did not seem to pull much from it.
Thanks in advance to all who reply.

What you could do is create a invisible 3d box surrounding your entities and check when two or more of said boxes have intersecting xyz coordinates. I can't supply you with code, but I know it works. You would have to figure out the coding for yourself

Related

Agar.io-like cell physics

I wanted to make a circle that has a ripple-effect on the edges, kind of like in the game agar.io. I am kind of lost on how to implement it. Obviously I can't just g.fillOval() because that would draw a solid circle with no movement on the edges.
I'm not asking anyone to write any code for me (but if you really want to, I don't mind :D), but if you could point me in the right direction with some methods I should use. I am using Slick-2D library for java, if that helps.
I also tried analyzing the javascript source from the agar.io website to try to understand how they implemented it in javascript, but I was unsuccessful because the code was obfuscated; all the methods and variables were just single letters.
The only way I can imagine doing this currently is to have each circle be composed of a number of points, and let each point have it's own physics, and it can be affected by other points. If anyone who has insight into this problem, I would greatly appreciate some help. Thank you!
I'm not sure you can do this with Slick2D. It is quite high level and gives a lot built-in classes. What you want to do is really specific. As Slick development has stopped you will not get new features. You should probably look at lwjgl which is the base of Slick. It is more low-level but can be more precise with the form you need.
You can look at this project to have some drawing cool stuff. And for another example of manipulating circle you have this one

Custom 3D Rendering

So I've been prodding ever so diligently at the internet as of late and have come across some interesting games. The basic example is Minecraft4k. It was made for the Java4k contest a few years back, but what I am really interested in is how the rendering was done. There are a lot of games like this made every year, but I really can't find much on how the creators went about synthesizing 3D worlds, let alone with minimal code.
The basics that would have be implemented would be polygon filling, z-ordering, and some sort of "fog" in order to prevent too much landscape from being drawn (optional, really). I've read up on the Scan line filling algorithm and have a working example but I have no idea how to get any form of z-buffering working. So the question is, does anyone have any experience with this sort of custom 3D rendering work? If so, any tips/pointers/resources you can point me to?
I know this is a bit of a shallow and perhaps inadequate question, but I figured I would try on here. Thanks in advance!
Wikipedia is a good start point (though it is bad for me to post a link) and explains about different techniques.
I developed a 3D software renderer for dots (the simplest 3D renderer ever ;)) and the z-buffering consists of sorting an array of rendered elements according to the Z coordinate, which in turns depend on the projection you are using, either orthographic, isometric, etc. (see another Wikipedia article about projections). In the simplest projection, you simply ignore the Z coordinate when drawing object, but take it into account during rotations (as it has an impact on X and Y).

Cellular Automata in Java 3D

I have created a Cellular Automata implementation in Java 3D. Everything is working correctly but I would need some starting patterns to start off with. As of now I have 2 cell states: Visible and Invisible.
Now my question is: how would I define a cylindrical pattern, for example, of Visible cells to initiate the simulation with? I have searched the web but I'm not getting any results, it seems. Is there some sort of formula to define the bounds with for a cylindrical one?
Any advice or pointing me in the right direction would be highly appreciated!
Thanks in advance.
Have you heard of Conway's Game of Life? I imagine you have, but just in case it's a cellular automata turn-based "game." There are a few good "starting positions" on the Wikipedia page.

Android 2D-pixel perfect collision library

I'm working on a 2D four-side scrolling game and I am currently implementing collisions. I was surprised to see that there is no pixel-perfect collision library implemented in the standard library, and so I wrote my own collision "engine" with geometrical forms to represent non-geometrical figures. For now, it works fine, but I really want to know if there's a way to just get it all over with, thanks to a well-built library. If anyone knows of one, please share it.
I recommend you to take a look to AndEngine. You can see one video here about 2d pixel perfect collision:
http://www.youtube.com/watch?v=abbXURuDaTo

Appropriate Transformation for 3D-looking 2D drawing (Java)

I'm looking for the appropriate transformation to make a 2D image look like a 3D drawing. If I draw a "road" with parallel lines on a sheet of paper, and then tilt the top of the page away from you, so that the road appears to be disappearing into the distance is what I am looking for.
I'm using Java and would like an appropriate API/library. I don't believe "AffineTransformation" accomplishes this.
You don't want an AffineTransformation, as that will always preserve parallel lines, which isn't what you want here.
Luckily the Java Advanced Imaging API (javax.media.jai) has exactly what you want, in the shape of the PerspectiveTransform class (click that link for docs).
Your problem is not trivial, but certainly solvable. You can take any four-sided image and apply a 3D perspective transformation. Just don't expect it to be a one-liner.
I'm at home now (checking SO before going to sleep, of course :D), but I'm almost 100% certain this is the site I used to find the appropriate code in C#:
http://ryoushin.com/cmerighi/en-us/61,2007-10-29/Image_Distortion_Enhancements.aspx
Porting it to java should be fairly straightforward. Let me know if the link doesn't solve your answer and I'll edit my answer tomorrow with more info.
I can't give you a simple answer, but I can tell you that what you're looking to draw is called two-point perspective. With this information, maybe you will be able to find a library that takes a 3D object and produces a perspective view.
Here's a simple Java applet that I've seen previously that demonstrates 2-point perspective:
Link
Hope this helps!

Categories

Resources