[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtkusers
Subject:    Re: [vtkusers] Re: Simple Collision Detection between camera and
From:       Goodwin Lawlor <goodwin.lawlor () ucd ! ie>
Date:       2007-01-31 15:50:03
Message-ID: 45C0BAAB.20105 () ucd ! ie
[Download RAW message or body]

Chris Hughes wrote:
> Hi Goodwin,
> 
> The vtkOBBTree looks like it could do exactly what I need. However I am 
> really struggling to get it to work. I have a closed polygon mesh and I 
> have ried to set up he OBBTree like this:
> 
>            vtkOBBTree *obbTree = vtkOBBTree::New();
>            obbTree->SetDataSet(vPolyDataReader->GetOutput());
>            obbTree->SetMaxLevel(10);
>            obbTree->BuildLocator();
> 
> I then have a look which runs a simulation and moves the camera around 
> and include:
> 
> ioo = obbTree->InsideOrOutside(ren1->GetActiveCamera()->GetPosition());
> 
> However this causes the application to compile but crash with a 'has 
> encountered a problem and needs to close' style error. Any suggestions?
> 
> Many thanks..
> 
> Chris

Hi Chris,

Could be a couple of things... Try:

1. vPolyDataReader->Update();

before setting it in the OBB tree.

2. Rather than passing the pointer, it's usually safer to try:

double pt[3];
ren1->GetActiveCamera()->GetPosition(pt);
ioo = obbTree->InsideOrOutside(pt);


hth

Goodwin

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic