New Tiled Terrain Scene Node [works with Irr 1.5]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Then that's what you should be trying to fix, not adding a triangle selector...
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

somehow i've managed to add the triangle selector and works..now i'm having some troubles with the heightmap because in irrlicht it is completly flat :)


but i guess i'll use smaller textures and heightmaps :)

here is the code for WoW camera and the triangle selector for the terrain:

Code: Select all

//terrain triangle selector, used for camera
	scene::ITriangleSelector* selector = terrain->getTriangleSelector();
	terrain->setTriangleSelector(selector);
	scene::ISceneNodeAnimator * anim = smgr->createCollisionResponseAnimator( selector, actor, core::vector3df(3,5,3),	core::vector3df(0,-9.81,0), core::vector3df(0,-0.1,0));
	actor->addAnimator(anim);
	anim->drop();
//camera RPG (test)
	irr::scene::CCameraRPGSceneNode* camera = new irr::scene::CCameraRPGSceneNode(actor, smgr, 1, device, selector); 
	camera->configure("cam.xml");
	smgr->setActiveCamera(camera);
    camera->drop();

	// set terrain to follow camera
    terrain->follow(camera);
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

ah. $#|t still doesn't collide :))
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

Because the physic engine is the one responsible of your mesh... Just go fix THAT bug...
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

i'm trying.. but i've lost all my ideas :(
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

That's OK, I hear EA are recruiting producers at the moment.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

nice to hear.. go and send them a CV and intention letter ;)
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I was newer integrating it with any physic engine so I can't help you here but about triangle selector: you may look at getIntersectionWithLine() function. It first finds triangle with which line is colliding (thats what you want) then calculate intersection between line and that triangle. You can skip later and just modify it to return triangle.

All functions are heavily commented so it should not be difficult.

That function is optimized for tiled terrain (that is grid) so its quit fast.
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

fixed :)

the rpg camera was behind those problems :d

now it works as it should :D
timetokill
Posts: 74
Joined: Tue Jul 22, 2008 4:28 am
Location: Los Angeles

Post by timetokill »

Sorry to dig this thread up... I accidentally posted the following in another thread:

Thanks arras, this is amazing!

However..

I noticed that a limitation of the ShTlSceneNode is that it cannot be placed in a negative position in the world (at least on the X or Z axis). The class actually keeps it from being placed in negative territory. Right now I have my game centered around the origin and I would love to be able to use this terrain system. Is there a way for me to change the code so that I can place the terrain anywhere?

I was thinking of going through the code and adding a X and Z offset value that would allow the arrays to still find their data without crashing (which I've experienced). Can anybody think of a better way or should I just try it? Anything I should watch out for?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Thanks timetokill :)

Of course you can place its origin in to negative axes. Class is derived from IsceneNode which use vector3df<f32> for possition so you can position it where you want. You are not restricted here. You cant rotate it however probably.

As for indexing tiles itself, they are indexed starting with 0 but thats standard indexing practice and if you want you can implement offset easily. You don't have to modify class itself.
timetokill
Posts: 74
Joined: Tue Jul 22, 2008 4:28 am
Location: Los Angeles

Post by timetokill »

Based on my tests it didn't seem the terrain could actually move into a negative area. Even in the demo it didn't go beyond x: 0, z:0.

In my tests with it, my world is at the origin. The terrain can START in a negative area, but as soon as something tries to move it it doesn't like it anymore. If I started in a positive area the terrain would continue to build around me but would stop if I went negative in either the X or Z axis.

Maybe it's just me but it seemed in setMeshPosition (I think that's what it was called) that it checked for a negative value and wouldn't allow it. When I removed that check, the array checks would fail as they'd be looking in a negative area.

I managed to work around it by just moving my game world out to x:4000, z:4000. No big deal :)
m506
Posts: 12
Joined: Wed Jun 18, 2008 5:34 am

Post by m506 »

Has anyone here had any luck integrating this with any physics library?

This is such a nice module that could be really awesome working together with some physics library such as newton or bullet.

I think that as it is now, it is very limited to what you can do with Irrlicht collision system, which is not particularly optimized as the external libraries.

Regards
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post by Frank Dodd »

Hi Arras,

I have made some modifications to your Tiled Terrain node and would like to include it into my latest IrrlichtWrapper release, as there is no clear license on the code can I have your permission to include it under the following license conditions that I release my code under: -

License

The Irrlicht Engine is based in part on the work of the Independent JPEG Group and the zlib. Please refer to the Irrlicht documentation and license agreements for further information.

This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.


Many thanks,
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Hi Frank, my code is free, you can do what ever you wish with it. No restrictions.
Post Reply