Page 1 of 1
how can i get all points from terrain triangles (solved)
Posted: Sat Oct 06, 2012 10:00 am
by noals
hi,
basicaly i would like to be able to use all points of something i render in irrlicht.
from my terrain, i think i have to get all triangles first from a triangle selector and from those, deduce all points or something right ?
i try to use the third fonction getTriangle of the API but it dont seem to work + i dont think i use it well either.
i use irrlicht 1.7.3
http://irrlicht.sourceforge.net/docu/cl ... ector.html
i tryed that :
Code: Select all
std::vector<core::triangle3df> terrainTriangles(115200, 0); // allocate memory at runtime
//my terrain got 115200 from getTriangleCount()
scene::ITriangleSelector*terrainSelector
=smgr->createTerrainTriangleSelector(terrain,0);
terrain->setTriangleSelector(terrainSelector);
terrainSelector->getTriangles(terrainTriangles,115200,115200,NULL); //trying to get all the triangle in the vector
terrainSelector->drop();
it dont compile
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
do you know a good method to get all point from a terrain or whaveter stuff i render in irrlicht ?
Re: how can i get and stock all triangles of a selector ?
Posted: Sat Oct 06, 2012 4:41 pm
by serengeor
You're passing 'std::vector<core::triangle3df>' to 'getTriangles' function, but it doesn't work with std::vector type, no irrlicht function does afaik.
If you'd look at the declaration of the function more closely you'd see that it requires a pointer to object(s) of 'core::triangle3df' type.
You can get that data from vector object using [] operator and probably there's also a function for that.
Re: how can i get and stock all triangles of a selector ?
Posted: Sun Oct 07, 2012 5:30 am
by noals
yeah its because i tryed to use std::vector for memory allocation but im not familiar with it, i just copyed it from someone who advised it to me.
You can get that data from vector object using [] operator and probably there's also a function for that.
thx
it should work with that i think :
Code: Select all
core::triangle3df* terrainTriangles = new core::triangle3df [115200];
but i kinda have the same problem because even before trying to compile i get an error message from vc++2010 that i should matches the argument list so it mean that the third usage of getTriangle() isnt recognized or maybe i should use NULL for the argument i dont want to use ? dunno.
isnt there a better method to get all points ? i changed my title.
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 10:02 am
by serengeor
Oh and you also passed the third parameter wrong. You shouldn't pass a value there, cause it's used to return the triangle count that got written into your array (hence the reference).
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 10:52 am
by noals
thx, it works with that :
Code: Select all
terrainSelector->getTriangles(terrainTriangles,115200,TriangleCount,NULL);
now i guess i just have to put a container for all my triangles.
is there a fonction i could use to get all point from one of this triangle ?
http://irrlicht.sourceforge.net/docu/cl ... gle3d.html
for the little history, i tryed newton engine but i had lots of errors and im still arent able to make anything to work with it, im not really interest in others famous physic engines, i will maybe try some little one i found on the net.
http://www.chronoengine.info/chronoengine/
http://code.google.com/p/jitterphysics/
http://bepuphysics.codeplex.com/documentation
but i also kinda think about making my own or something with the help of those links
http://gafferongames.com/game-physics/
http://www.wildbunny.co.uk/blog/2011/04 ... r-dummies/
so i think i should first get all point and then make calculs from that.
i dont know how i will optimize anything since i dont think its a good idea to use calculs for each points in the 3D world in real time but i dont know yet how i can get all point from irrlicht anyway ...
seeing the fonctions in irrlicht, maybe i could use getPlane, getNormal (dunno what it is), isPointInside or something to do my collision check. what do you think about it ?
thinking about it, maybe i can get all those point in a matrice from the triangles coordonate i have with a math fonction or something, im not really familiar with matrice, i know what they are but i never used them yet.
any hint, advice ?
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 2:47 pm
by serengeor
Points are public members of that class.
noals wrote:
but i also kinda think about making my own or something with the help of those links
Creating a collision, physics engine isn't something a beginner with little knowledge of math could do.
noals wrote: ... getNormal (dunno what it is) ...
Normal basically is perpedicural to the triangle(surface) in one or other direction.
noals wrote:
thinking about it, maybe i can get all those point in a matrice from the triangles coordonate i have with a math fonction or something, im not really familiar with matrice, i know what they are but i never used them yet.
any hint, advice ?
You should either learn the math required for what you need to do or use a library that will simplify that for you.
You could try bullet physics as it is quite easy to integrate into any project.
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 3:51 pm
by noals
Points are public members of that class.
i meant the points within the triangle, those that make the plane.
Creating a collision, physics engine isn't something a beginner with little knowledge of math could do.
its not because some peoples needs years to learn something that some others cant understand it faster.
i learn while doing, some learn to learn and then do to do, i learn to do, is it so hard to understand some noobs like me ?
Normal basically is perpedicural to the triangle(surface) in one or other direction.
cool, thx.
You could try bullet physics as it is quite easy to integrate into any project.
yeah thats not the first time im advised this engine, i checked it but didnt tryed it, didnt feel like it.
as a start with a physic engine and irrlicht, i try to make my terrain 'solid' so i can then do whatever test i want with the terrain as my ground.
i will try but from search result it seem i will have dificulties using heighmap terrain from irrlicht with bullet.
i will post again later about that if i have some problems i think.
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 6:16 pm
by serengeor
noals wrote:i meant the points within the triangle, those that make the plane.
I don't get which plane you are talking about, since you showed a link triangle class I assumed you weren't sure how to get triangle points.
noals wrote:
its not because some peoples needs years to learn something that some others cant understand it faster.
i learn while doing, some learn to learn and then do to do, i learn to do, is it so hard to understand some noobs like me ?
I don't say you won't be able to learn it (fast). What I meant is that you should learn the most important stuff beforehand so for example it would be more clear when looking at other implementations.
Take a look at this explanation of collision algorithm:
https://mollyrocket.com/849, without good knowledge of vector math, trigonometry and other stuff you'd get lost pretty quick.
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 8:57 pm
by noals
I don't get which plane you are talking about, since you showed a link triangle class I assumed you weren't sure how to get triangle points.
i mean all the points that make my triangle full of points and not just 3 lines.
lets say i have a triangle in 2D myTriangle(0,0; 2,0; 0,3) for exemple
so all points (0<=X<=2, 0<=Y<=3)
not sure how you say "smaller and egals to" in prog through.
i guess i just have to do that 3 times for the 3D axes anyway.
Re: how can i get all points of something i render in irrlic
Posted: Sun Oct 07, 2012 9:05 pm
by serengeor
noals wrote:I don't get which plane you are talking about, since you showed a link triangle class I assumed you weren't sure how to get triangle points.
i mean all the points that make my triangle full of points and not just 3 lines.
lets say i have a triangle in 2D myTriangle(0,0; 2,0; 0,3) for exemple
so all points (0<=X<=2, 0<=Y<=3)
not sure how you say "smaller and egals to" in prog through.
i guess i just have to do that 3 times for the 3D axes anyway.
That would be infinite amount of points in theory since you're working with floating point numbers.
Why would you want that?
Re: how can i get all points from terrain triangles (solved)
Posted: Mon Oct 08, 2012 6:32 am
by noals
That would be infinite amount of points in theory since you're working with floating point numbers.
oh yeah, didnt though about that lol. i can limit it.
Why would you want that?
because collision would always come first between 2 points so i need to know those points.
it would need rules for exeptions like if more than 2 points are involved at the same time, i would have use some kind of occtree using distance or something, didnt really though about that yet.
edit : and looking at bullet code and api, i still really dont feel like trying it. dunno, it seem there is a lot in bullet but its like i dont need that lot u know.
Re: how can i get all points from terrain triangles (solved)
Posted: Mon Oct 08, 2012 7:52 am
by serengeor
noals wrote:
Why would you want that?
because collision would always come first between 2 points so i need to know those points.
it would need rules for exeptions like if more than 2 points are involved at the same time, i would have use some kind of occtree using distance or something, didnt really though about that yet.
Still I think you don't need to get the points from triangle. If you're calculating collisions then the points would be calculated with some sort of algorithms, you don't need to know them in advance.
noals wrote:
edit : and looking at bullet code and api, i still really dont feel like trying it. dunno, it seem there is a lot in bullet but its like i dont need that lot u know.
Yes bullet has quite big API, but that doesn't mean you have to learn and use everything. And the samples included there are really simple and easy to follow once you know basic terms used in physics/engine.
You can read them :
http://www.bulletphysics.org/mediawiki- ... y_of_Terms
Also I you could look at
Tokamak physics engine.
Re: how can i get all points from terrain triangles (solved)
Posted: Mon Oct 08, 2012 8:38 am
by noals
And the samples included there are really simple and easy to follow once you know basic terms used in physics/engine.
sorry i dont agree. the "simple" hello world example from the SDK is self explanatory from my point of view. thats not the first time i read stuff about bullet but each time i just dont feel like trying it.
Also I you could look at Tokamak physics engine.
yep, i kinda liked tokamak but it seems it lacks some community + it use lua scripting or something in the SDK demo, its confusing me.
for now, im interested in chrono.
http://www.chronoengine.info/chronoengine/features.html
it seem to more fits my need and it use irrlicht in the tutorials, i will ask on their forum how i could make my terrain solid using it because even if its not the more important, i still want that as my base for testing purpose and chrono dont seem optimized for this kind of work. (here i kinda have to wait because their forum need an admin aproval for registration.)
Re: how can i get all points from terrain triangles (solved)
Posted: Mon Oct 08, 2012 9:17 am
by serengeor
noals wrote:And the samples included there are really simple and easy to follow once you know basic terms used in physics/engine.
sorry i dont agree. the "simple" hello world example from the SDK is self explanatory from my point of view. thats not the first time i read stuff about bullet but each time i just dont feel like trying it.
To be true I didn't really like bullet for the first few times I saw it either (It was also the first phys. engine I used, I think). But that was because I couldn't really understand where to start and how everything works.
noals wrote:
Also I you could look at Tokamak physics engine.
yep, i kinda liked tokamak but it seems it lacks some community + it use lua scripting or something in the SDK demo, its confusing me.
Yes it probably lacks community support, but that doesn't mean you can't try using it.
Also I don't think that it uses scripting internally, maybe only in the samples so it would be easier to play around without having to recompile everything.
noals wrote:
http://www.chronoengine.info/chronoengine/features.html
it seem to more fits my need and it use irrlicht in the tutorials, i will ask on their forum how i could make my terrain solid using it because even if its not the more important, i still want that as my base for testing purpose and chrono dont seem optimized for this kind of work. (here i kinda have to wait because their forum need an admin aproval for registration.)
Strange that you want to use chrono instead of bullet, when chrono itself uses bullet to do the work.
Also I found that it's using irrlicht for something
Re: how can i get all points from terrain triangles (solved)
Posted: Mon Oct 08, 2012 11:48 am
by noals
Strange that you want to use chrono instead of bullet, when chrono itself uses bullet to do the work.
didnt know lol.
Advanced collision methods are available thank to the Bullet collision detection engine, which is wrapped inside Chrono::Engine.
chrono just seem more accessible to me when i check the doc, tokamak too by the way, you're right, when i check the API it dont seem that hard.
thx for all your answers.