You are not logged in.

#1 Sep 08, 2012 9:58 AM

Gekoncze
Baby Dragon
Award: Speedway Contest Winner Final
From: Czech Republic
Registered: May 16, 2009
Posts: 5,389
Gems: 145
Age: 30 years old
Gender: Male

3D for testing collision checking

I am going to experiment with collision checking in my 3D Sparx game, but I don't have any Sparx world like 3D terrain (in fact I have no 3D models yet (just n-gons representing objects), bc I am noob at 3D modeling). So I wonder if anybody here is good at modeling 3D. I just need plain *.obj file (or some that can be converted in blender into obj) with small Sparx world like room. It have to be low-poly like on the picture below, but it don't have to have textures or colors. (but of course it can wink )

On this image you can see how is the room made in Spyro YotD. You can propably see the the wall is made of squares. This shows how low-poly it is (no ultra smooth edges).
http://files.spyropictures.webnode.cz/2 … detail.png

It is not critical, I can somehow rig it up together, but I just thought I could try it here first.

Thanks for any advice. smile

btw it look like I am going to use some library for the collisions (maybe coldet) so if anybody knows some good library that can do fast sphere x triangle collision checking (or some other way how to do it) let me know.

Offline

#2 Sep 10, 2012 3:54 PM

Sheep
Member
Award: Skateboard Contest Winner
From: Norway
Registered: Jan 24, 2008
Posts: 983
Gems: 0
Birthday: 20 January
Age: 31 years old
Gender: Male
Website

Re: 3D for testing collision checking

I made room:
http://host-a.net/u/Greenblizzard/sparxlevel.obj

And about collision, if you're trying to make something like the Sparx levels in Spyro 3, I can't see why you would need 3d sphere x triangle collision, even though they used it in their game.
You could just calculate the silhouette of the world at a certain height value above the floor, make a list of lines from it, and do circle x line collision instead, which would be much faster.
But if the game involves Sparx somehow changing height, E.g flying upwards or going over bridges, this wouldn't work.

What are you making this game with?

I don't know much of any collision libraries for any language or game engine, but I made a 3d platformer prototype about a year ago with javascript and HTML5 Canvas, which, among other things, required me to write sphere x polygon collision checking and reaction to that collision.
Link It only runs at an acceptable fps in Chrome.

Anyway, if speed becomes a problem, I would suggest that the collision data is split up into a 2d grid when the level loads, so that you would only have to check against the triangles or lines in the nearest grid cell(s).

Offline

#3 Sep 10, 2012 5:51 PM

Gekoncze
Baby Dragon
Award: Speedway Contest Winner Final
From: Czech Republic
Registered: May 16, 2009
Posts: 5,389
Gems: 145
Age: 30 years old
Gender: Male

Re: 3D for testing collision checking

Thanks for the room Sheep ^^

You could just calculate the silhouette of the world at a certain height value above the floor, make a list of lines from it, and do circle x line collision instead, which would be much faster.

That is almost the same way as I did first smile, but I want Sparx to be able to do this:

changing height, E.g flying upwards or going over bridges

What are you making this game with?

I am making it on my own in C++ using SDL, opengl and openal. I use QtCreator but I don't use any qt libraries for this project... QtCreator's text editor is just sooo comfortable and easy to use.

I don't know much of any collision libraries for any language or game engine, but I made a 3d platformer prototype about a year ago with javascript and HTML5 Canvas, which, among other things, required me to write sphere x polygon collision checking and reaction to that collision.
Link It only runs at an acceptable fps in Chrome.

I'll take a look at it.

Anyway, if speed becomes a problem, I would suggest that the collision data is split up into a 2d grid when the level loads, so that you would only have to check against the triangles or lines in the nearest grid cell(s).

Yeah I was thinking about something similar. Maybe I will use it.

Offline

#4 Sep 10, 2012 7:55 PM

Sheep
Member
Award: Skateboard Contest Winner
From: Norway
Registered: Jan 24, 2008
Posts: 983
Gems: 0
Birthday: 20 January
Age: 31 years old
Gender: Male
Website

Re: 3D for testing collision checking

Blako wrote:

That is almost the same way as I did first smile, but I want Sparx to be able to do this:

changing height, E.g flying upwards or going over bridges

Great smile I had never thought about that possibility in a Sparx game before I tried to come up with the reason not to use line collision in it. It would certainly make it more interesting. I look forward to seeing how this game evolves!

You would probably get a faster collision from a library dedicated to the topic, but if you're interested, here's my method of collision and reaction with triangles(roughly):

Hidden text

Test for collision between a sphere with a radius that is considerably larger than the moving object(sphere) and the terrain. Make a list of the triangles that did collide. These are the ones the moving object could potentially collide with.

repeat x number of times, or until there is no collision:
Find the triangles the object(sphere, this time with actual radius) would hit at (x+xspeed,y+yspeed,z+zspeed), and add to the speed vector the vector going from the triangles nearest point to the center of the sphere multiplied by (radius - distance) / radius.


The sphere x triangle test is:
IF the center of the sphere is within the "beam" of the triangle{
project the sphere position to the triangle's plane. If the distance between this position and the sphere's position is smaller than the sphere's radius, there is a collision
} else {
Find the nearest point on the triangles edges. If the distance between this point and the sphere is smaller than the radius, there is a collision
}

I am making it on my own in C++ using SDL, opengl and openal. I use QtCreator but I don't use any qt libraries for this project... QtCreator's text editor is just sooo comfortable and easy to use.

I honor your choice of building it yourself, rather than using Unity or other game engines tongue
I tried to learn C++ recently, but have gave up temporarily because I needed to display graphics on the screen to have any motivation to program anything, but when I tried to download/install either DirectX or openGL, the compiler complained about some files missing, and when I tried to download those, it needed more files and so on. Ugh. So I'm using javascript again for my current project, but with WebGL rather than a javascript and 2d canvas based 3d engine.

Offline

#5 Sep 11, 2012 12:59 PM

Gekoncze
Baby Dragon
Award: Speedway Contest Winner Final
From: Czech Republic
Registered: May 16, 2009
Posts: 5,389
Gems: 145
Age: 30 years old
Gender: Male

Re: 3D for testing collision checking

I tried to learn C++ recently, but have gave up temporarily because I needed to display graphics on the screen to have any motivation to program anything, but when I tried to download/install either DirectX or openGL, the compiler complained about some files missing, and when I tried to download those, it needed more files and so on. Ugh. So I'm using javascript again for my current project, but with WebGL rather than a javascript and 2d canvas based 3d engine.

Yeah, installing libraries on Windows is horrible - you have to setup everything yourself. I'm glad I am using linux where you just type sudo apt-get install <libraryname> and everything is done by the package manager big_smile
I am making it multiplatform of course, so Windows, Linux and I hope also Mac users can play it. (I don't have Mac on any computer, so I cannot try it)

EDIT: Tried the coldet library and the result is: !@#$%$^%&*
1st compile: error need to define which compiler is used O _o I have never seen this in any library...
2nd compile: errors undeclarated functions - didn't need them - commented out those function calls
3rd compile: bunch of warnings (I don't like warnings) and error wile declaring some coldet class - it don't have param free contructor
4th compile: realized I have to use some other... strange class o_ O
5th compile: 1st compile error again o_ O how many times do I have to define it? - putting #define GCC to all coldet files
6th compile: watching how warnings count raises up, error NULL was not declared X_X
result: the worst library I have ever tried to use, I have to take a break and SPAM IT UP, I'll try to read its docs more deeply and if it fails again, I am going to use your way sheep

Offline

#6 Sep 15, 2012 4:24 AM

Swaffy
Member
Registered: Aug 24, 2008
Posts: 6,587
Gems: 218

Re: 3D for testing collision checking


Aah, I see you're programming a game. Yeah, troubleshooting is one of the
biggest pains in the butt you can go through. It happens to me when I mod
my computer game. Sometimes it's a single wrong symbol that crashes the
game. Best of luck to you, man. The outcome will be worth your effort.

So you're coding this game using C++?


2i0zslx_th.jpg8x0xaf_th.jpgdrf14y_th.jpg25euwjd_th.jpg2rwakus_th.jpgo85htj_th.jpg

Offline

#7 Sep 15, 2012 3:16 PM

Gekoncze
Baby Dragon
Award: Speedway Contest Winner Final
From: Czech Republic
Registered: May 16, 2009
Posts: 5,389
Gems: 145
Age: 30 years old
Gender: Male

Re: 3D for testing collision checking

Aah, I see you're programming a game. Yeah, troubleshooting is one of the
biggest pains in the butt you can go through. It happens to me when I mod
my computer game. Sometimes it's a single wrong symbol that crashes the
game. Best of luck to you, man. The outcome will be worth your effort.

That's right I spend tons of time just debugging.
As for libraries, I am used to just put #include <headername> and happily use it, but I haven't yet came across such nasty library like coldet.

So you're coding this game using C++?

Yes, c++ with some libraries like SDL, opengl and openal. It is fast and easy to use, but I had to learn it on my own, because at school, we learn just Java  <_<

Offline

Board footer

Powered by FluxBB