Jump to content

Mouse Picking issue


Rick
 Share

Recommended Posts

I've noticed an issue when picking some models that the pick seems to go through the model in certain areas. In the example below if you run it'll be a model of a door and the picking is done each frame. It will display what is being picked in the top left of the screen (door01 or Nothing). Notice how if you move your mouse around the top right and bottom right the text will flash between "door01" and "Nothing". If you play with the scripts/camera.lua file and change the pick diameter to say .1 it's even more pronounced.

 

The problem is that if you have a top down camera the bigger the diameter of the pick the more issues you have with it picking things you don't want. The precision of the pick becomes worse with a wider pick diameter, but with a smaller diameter the pick goes through models in certain areas. This is a problem in our game. Interestingly enough, if you cover the door with csg it works fine (but this is a hack to ask to do this). So something with model files the picking gets weird results based on diameter size.

 

https://www.dropbox.com/s/wlaxubn7f07ivz6/PickingIssue.rar?dl=0

Link to comment
Share on other sites

Hi Josh,

 

In the last couple of days I've changed over the floor collision of houses to the 'poly mesh' type as I am now able to generate navmesh with it which is a better solution than using hints. Since doing that this issue is presenting particularly devastating one as an exact pick is a major part of game play.

 

 

I added code a sphere to be created at the location in the main game and the picks at times are nowhere near where the cursor is, angles of objects appear to play a part in it too.

 

 

Add this to the pick to visually see where the pick is going in the provided project....

 

model = Model:Sphere()

model:SetScale(0.04, 0.04, 0.04);

model:SetCollisionType(0);

model:SetColor(1.0,0.0,0.0)

model:SetPosition(pickInfo.position)

 

 

If you could look into what's going on with picking that would be fantastic! Its really put the project in a bad state.

 

Thanks

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

As I dont have a way to test and its not posted in the original post, but have you tried setting the entities' pick modes to polygon pick and the pick's radius to 0? My understanding is that is the most precise pick on objects that are not animated models. Spherical picks are supposedly slower and with a true setting for closest return I could see how it might occasionally give unexpected results. Also, are you using a specific collisiontype for your pick? If the pick's collisiontype is set to 0 which will collide with everything pickable and you are using a pick radius then that could cause problems as well.

 

Also, I never had an opportunity to test and its not in the documentation that I am aware of, but is the radius value in meters? If so, then it would definitely cause issues getting a precise pick.

 

Also TJ, I would also suggest setting that sphere's pick mode to none so it is ignored when troubleshooting.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I see the link but I dont have access to LE for another couple weeks - but the comment about not being posted in the original post, is that it is never mentioned if a pick radius of 0 and polygon pick mode had been tried. Spherical picks are slower and less precise just by their nature. Also using the pick's collisiontype to act as a filter will give better control than just picking everything that is pickable.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...