RaySceneQueries problem

Druha

09-11-2005 17:57:11

To determine players height, I used ray scene queries, but there i used terrain sm.
Now my old code doesn't work with plsm, it returns strange results - between pages character "jumps" up and down, but along the page its height doesn't change anymore.
What is this?
Maybe I use queries wrong?

tuan kuranes

10-11-2005 09:06:44

try using mask for queries, look in PLSM2 in Demo Code for all use of scene queries.

Druha

10-11-2005 14:24:46

Thanks, but results aren't correct yet. Sometimes entity falls down, and sometimes flies over it, and always at the same places

fiesch

10-11-2005 14:53:32

hm that sounds a lot like the problem i still have with parts of my terrain.. i keep falling through it no matter what i do - this is my collision code:


{
Vector3 resPosition=Ogre::Vector3::ZERO;
//cast a ray into scene and get intersection point
checkRay = Ray(position, Vector3::NEGATIVE_UNIT_Y);
rayQuery->setRay(checkRay);
rayQuery->setQueryMask(RSQ_Height); //PLSM2 mask
rayQuery->execute ();
RaySceneQueryResult& result = rayQuery->execute();
RaySceneQueryResult::iterator i = result.begin();
if (i != result.end() && i->worldFragment)
{
resPosition = i->worldFragment->singleIntersection;
}
return resPosition.y;
}

Druha

10-11-2005 15:05:45

Mine is the same

tuan kuranes

11-11-2005 07:43:31

if using CVS, try adding that in your terrain cfg file :

# Under Cam make LOD always at max, no matter how simple is the tile
MaxLodUnderCam=yes


so that we see if it's lod related...

fiesch

11-11-2005 09:20:07

nope, no change

tuan kuranes

11-11-2005 09:41:33

could you give me a reproducable path on the demo ?
(camera pos, etc...)

fiesch

11-11-2005 11:10:46

Hm could take quite some time - i could easily give you a pos on the terrain coming from my own sys (it's still your demo terrain)

tuan kuranes

11-11-2005 12:29:17

that's ok. should not be related to your sys. It's more terrain and terrain cfg related.

fiesch

13-11-2005 11:18:38

Hm sorry was in a lot of stress lately and now happen to have caught an ugly crash - i have a safe spot: (4,42373/419,173/234,705)
in very close proximity to that spot the ray query fails...

I'm using the standard terrain, unscaled and untranslated.

Sorr i can't be more specific right now, I'll get back to you as soon as i fixed some bugs over here

tuan kuranes

14-11-2005 07:40:04

try latest cvs (as stated here, I resolved some query bugs)

fiesch

17-11-2005 12:17:35

Hm the issue remains...

Now that BBoxes are woriking i confirmed that it is (at least in a part) page-related

The pages are a bit overlapping, 88/421/377 is asafe spot, -40/397/392 is not.. that's the same long the borderline of the next few pages (that's how far i tested for now) - so i assume that it is sign-related.

I remember a line that was also along the z-axis which marks a "unsafe" are, so that sign-problem might be the same with the z-axis, too

tuan kuranes

17-11-2005 12:27:18

which terrain is the "standard terrain" ?

fiesch

17-11-2005 12:46:59

The one specified in "paginglandscape2.cfg"




DefaultMap=Terrain_Scene_Manager_Terrain



puget_sound=ps_height_1k

#grand_canyon=gcanyon_height_4k2k

#terragen_generated=terragen16bits

#European_Alpes=Alpes

Terrain_Scene_Manager_Terrain=TsmTerrain

def=Default



# resource group name where to find map definition

GroupName=PLSM2



# Try forbidden textureformat combinations

TextureFormatDebug=no


# Under Cam make LOD always at max, no matter how simple is the tile
MaxLodUnderCam=yes

tuan kuranes

17-11-2005 13:07:00

Should be fixed in cvs (today commit).
Was 'stictching' on tiles border.
Still need to fix Tiles Corner stitching.

[edit]
now fixed
If still bugs after this commit please report.
[/edit]

fiesch

18-11-2005 09:03:56

hm checked the cvs out 2 hours ago - problem remains - i don't know if your commit is in it, though - my rev here is 1.27

i confirmed the rayQuery problems on negative z, btw.. so it's both -x and -z - the quarter of the terrain within positive x and z gives visually correct results

tuan kuranes

18-11-2005 10:23:14

OgrePagingLandScapeData2DManager.cpp should be 1.48

fiesch

18-11-2005 13:57:30

hm true i should have given the file i checked it on ;) was the scene manager itsself.

OgrePagingLandScapeData2DManager.cpp is 1.48...

so the problem remains

fiesch

18-11-2005 15:52:26

ahm just to clarify - it's the whole area with negative coordinates, not just the tile borders that's having these issues..

tuan kuranes

18-11-2005 16:55:16

cannot reproduce the bug with current version...
or maybe I don't understand clearly the reproducable steps or the bug ?

fiesch

18-11-2005 21:06:42

hm I'll try to reproduce it with a demo... might be -as always - some time..

I do hope that it's not in my code but well - you saw my height callback code in the other post, there's not much to it

fiesch

20-11-2005 23:49:45

Ok the problem is not PLSM2-related as it seems..
for some real strange reason OgreOde doesn't call my heightListener on negative x/z values

SuperMegaMau

01-03-2006 12:04:17

Ok the problem is not PLSM2-related as it seems..
for some real strange reason OgreOde doesn't call my heightListener on negative x/z values


Probably because the Terrain SM does not have negative x/z values, because the 0,0,0 its at the edge of the terrain, not the center like PLSM2

PS: well, probably you already solved the problem...