ArBuZ Posted July 14, 2010 Share Posted July 14, 2010 Hi! Sorry for double post, but by mistake Ive posted it in C++ section and as I expected I haven't received any answer. I think only Josh can take care of this. But he is must be busy now and doesn't visit that forum section. Its strange that still nobody have met such problem. This problem even exists for scene entity. Please forgive me for second same post. But I really need some work around on this problem. Thanks in advanced. Here is the problem: If I have an object (for example Cube called "mesh") parented to some other object (another cube called "ground"). In main loop I make ray-cast (camera pick). The both cubes are visible and they are visible for ray-cast. Now I hide the cube "mesh" (the child). And it is still visible for ray-cast!!! I want to hide different parts of some model, and make this parts unavailable for ray-casting, but the rest of the model should be visible and available for ray-casting. And the Scene entity - is a parent of all entities, so I cant hide any scene child from ray-cast. As I understand this problem is consequence of new octree culling system in the engine. But I really need the way as raycasting worked before. Or I will need to do a lot of tricks to make things to work. Here is simple example of the problem. Space - hide the cube. In main loop I make raycast each loop and display the name of picked entity. // ==================================================================== // This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard // Written by Rimfrost Software // http://www.rimfrost.com // ==================================================================== #include "leo.h" using namespace LEO ; int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { Engine engine( "VectorTest", 800, 600 ) ; Engine::SetAbstractPath( "C:/Leadwerks Engine SDK" ) ; Engine::SetFilters() ; World world( CREATENOW ) ; if( !world.IsValid() ) { MessageBoxA(0,"Error","Failed to create world.",MB_OK); return engine.Free() ; } Buffer gbuffer( Engine::GetWidth(), Engine::GetHeight() ); Camera camera( CREATENOW ); camera.SetPosition( 0, 0, -2 ); Material material("abstract::cobblestones.mat") ; Cube mesh( CREATENOW ) ; mesh.Paint( material ) ; mesh.SetKey("Name","Cube"); Cube ground( CREATENOW ) ; ground.SetScale( 10, 1, 10 ); ground.SetPosition( 0, -2, 0 ); ground.Paint( material ) ; mesh.SetParent(ground); DirectionalLight light( CREATENOW ) ; light.SetRotation( 45 , 45, 45 ); Source source; //myClass myC("abstract::gunshot.ogg"); //myClass myC2("abstract::reload.ogg"); std::string name=""; TVec3 pos; Pick picked; // Game loop while( !Keyboard::I****() && !Engine::IsTerminated() ) { if( !Engine::IsSuspended() ) // We are not in focus! { pos=Mouse::GetPosition(); pos.Z=50; if (camera.GetPick(picked,pos)) { name=GetEntityKey(picked.entity,"Name"); } else name=""; if (Keyboard::I****(KEY_SPACE)) { if (mesh.IsHidden()) mesh.Show(); else mesh.Hide(); } // Rotate cube //mesh.Turn( Vec3( 0.5f*AppSpeed() ) ) ; // Update timing and world Engine::UpdateTime(); World::Update( Engine::GetSpeed()) ; // Render gbuffer.Set(); World::Render() ; Engine::GetBackBuffer().Set() ; World::RenderLights(gbuffer); // Send to screen Draw::Text(0,0,"%s",name.c_str()); Engine::Flip(0) ; } } // Done return engine.Free() ; } Quote Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64 3ds max / photoshop CS3 / C++ http://www.arbuznikov.com Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.