Edit: Solved since merging latest master.
Hello, I’m calling Raycast() twice, the first time is fine, the second it crashes. The first time is with one scene, the second with a different scene. I don’t think the second scene has problems because if I cast the first time with the second scene it doesn’t crash. Relavent snippets:
Variable init stuff:
...
//Load scene.
main_->cameraNode_->RemoveAllChildren();
main_->cameraNode_->RemoveAllComponents();
main_->cameraNode_->Remove();
File loadFile(context_,main->filesystem_->GetProgramDir()
+ "Data/Scenes/solcommCity.xml", FILE_READ);
main_->scene_->LoadXML(loadFile);
main_->cameraNode_ = main_->scene_->GetChild("RavenMech")->GetChild("camera");
main_->viewport_->SetCamera(main_->cameraNode_->GetComponent<Camera>());
//Load moveButt scene.
scene_ = new Scene(main_->GetContext());
cameraNode_ = new Node(main_->GetContext());
File loadFile2(context_,main->filesystem_->GetProgramDir()
+ "Data/Scenes/moveButts.xml", FILE_READ);
scene_->LoadXML(loadFile2);
cameraNode_ = scene_->GetChild("camera");
...
crash happens below:
...
Ray cameraRay = cameraNode_->GetComponent<Camera>()->GetScreenRay(
(float) eventData[P_X].GetInt() / main_->graphics_->GetWidth(),
(float) eventData[P_Y].GetInt() / main_->graphics_->GetHeight());
PODVector<RayQueryResult> results;
RayOctreeQuery query(results, cameraRay, RAY_TRIANGLE, 1000.0f,
DRAWABLE_GEOMETRY);
scene_->GetComponent<Octree>()->Raycast(query);
...
results.Clear();
cameraRay = main_->cameraNode_->GetComponent<Camera>()->GetScreenRay(
(float) eventData[P_X].GetInt() / main_->graphics_->GetWidth(),
(float) eventData[P_Y].GetInt() / main_->graphics_->GetHeight());
query.ray_ = cameraRay;
main_->scene_->GetComponent<Octree>()->Raycast(query); //CRASH
...