randomkeyhits Posted November 10, 2014 Share Posted November 10, 2014 How limited are our abilities to play with Nav-Meshes? I can tell an entity to use one and be told whether its possible or not and as far as I know thats pretty much it. Can Nav-Meshes be targeted functionally? I was trying to see if I could use Camera::Pick() to know when the mouse was over a Nav-Mesh. I can have half the solution in that I can tell if the returned position is within a Nav-Mesh but I cannot guarantee that the Pick() will choose the surface with the Nav-Mesh Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
gamecreator Posted November 10, 2014 Share Posted November 10, 2014 How do you tell if a position is within a navmesh? Quote Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 10, 2014 Author Share Posted November 10, 2014 I create a pivot which I move to the point indicated and use GoToPoint() to the same location, if the return is true its in the navmesh, if false it isn't I then immediately use Stop() Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
gamecreator Posted November 11, 2014 Share Posted November 11, 2014 Clever. I like it. I think the function you're then looking for is Camera::Project. It'll give you the screen coordinates of the pivot. If your check is true and the coordinates match the coordinates of the mouse, your mouse is over a navmesh. You can also kind of use World::Pick (with points "before" and "after" your pivot) to get the entity that the navmesh is on. I say kind of because navmeshes aren't exact so your pick line needs to be long enough to cover this. And the longer it is the more of a chance that it'll grab another entity than the one you're looking for. So it's a balancing act. However, you can set collisiontypes so that should help too. I hope that made sense. Let me know if not. Quote Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 11, 2014 Author Share Posted November 11, 2014 Its the other way around at present, I'm starting with screen co-ordinates rather than 3D space. I'm currently using Camera::Pick() to get the location at which to place the pivot. Then I do the test to see if its NavMesh usable. A pick has one of three results, no intersection, first intersection or closest intersection. If the map has a complex topography, think multiple bridge spans to go over or under then being able to pick the correct part becomes very difficult. I'm already restricting collisions to scene rather than scene + props for the test. For now the solution is to be careful with level design but I'd like to be able to drop that limitation. I had a look at the World::Pick() function and think I have the gist of what you are saying, create a tangential line through the scene to see which piece of geometry might be the best fit. I'm not sure if it adds any new info but I'll go experiment with it to see if I can reveal something. Quote content over form, game play over all. 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.