Jump to content

Recommended Posts

Posted

I would like to pick a model (ground, not a terrain, just a mesh) behind a model (box) but don't know how.

 

Right now I have it set up like this:

 

ground->SetCollisionType(Collision::Scene);
box->SetCollisionType(Collision::None);

 

Vec3 p = window->GetMousePosition();
if(window->MouseDown(1))
{
  if(camera->Pick(p.x, p.y, pickinfo, 0, true, Collision::Scene))
  {
 box->SetPosition(pickinfo.position.x, 0, pickinfo.position.z);
  }
}

 

But it doesn't result in the box moving. However, if I remove Collision::Scene from the Pick function, it works (but also picks the box, which I don't want).

 

I know I can hide the box before the pick and show it again after but I'm building a bigger level and I'm trying to avoid hiding/showing hundreds or thousands of elements.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...