Jump to content

Distance Sensor as mesh locator


Shadow95
 Share

Recommended Posts

Hello,

I am working on a catch and run game, and I have cat and rat meshes along with a height map that creates walls for me. I have the locations of rat and cat, also my objective is using websocket to play this game, so I should know information about locations. Simply, I want to send some information to the users so, they can decide which way to go. In Gazebo simulation program, LaserScan that has distance array to the obstacles with decided view of angle such as pi radian is used for deciding which way to go with no knowledge of the world. How can I achieve this goal? How can I get the distances to obstacles which provided with some decided angle of view. 

I want to do this in that way, because any indexing can be wrong for some situations like roundoff errors may occur, but any suggestions is welcomed. Please consider the fact that I will send this information to users, and wait them to understand quickly.

Link to comment
Share on other sites

Hiya s95! 

I'm not qualified to answer, but heck, I'll still comment.  :)

Your idea will be difficult.  180 degrees of repeated pickingRays... for every "scan"... and that will ONLY tell you WHICH angles didn't intersect, or had intersects at far distances (indicating a direction that is usable.)  It does not indicate which is the RIGHT way, or the BEST way.  It just tells available directions that have no nearby blocking-obstacles.

At least I THINK that's how it COULD be done.  I have almost NO experience with pickingRays or "path-finding".

Perhaps some coffee and a doughnut instead?  :D

Perhaps a small overhead view(port) in the corner of the screen... showing maze (by coloring tops of walls), and cat/mouse locations?  Player could make decisions by sometimes looking at overhead view?  Perhaps make clouds float-across the corner-of-screen overhead view... making it unusable at times? 

Just some alternative ideas.  :)  Hopefully, MUCH smarter people than me... will comment soon.  Sorry if I interrupted thread. 

Link to comment
Share on other sites

Thank you for comment Wingnut. I know it is a very difficult job to done, but it will be used in a competition and there will be no time for competitors for looking at the map or the screen we will use to show the moves. Basically, competitors must explore the map and while doing that may be the cat catches the rat. If I understand you correctly, we are not using camera as movers, so the angle of view for showing moves is like an overhead view. 

I do not have sufficient knowledge, but rays can be useful :) There will be boundaries for the map, so it should collide somewhere :)

Any other ideas? 

Link to comment
Share on other sites

57 minutes ago, Shadow95 said:

are not using camera as movers, so the angle of view for showing moves is like an overhead view

:)  That's probably not quite right.  It will be first-person cam... and the rays will originate at the camera... laser range-finding, in a sweep like a panoramic camera might do.  (I think)  Probably avoid having low-height obstacles... because the ray-sweep could shoot above them (missing them).  Rays are rumored to be rather poor in performance.

Really, though... I should shut-up until the pros return from weekend partying.  :)  I'm not a game coder at all.  But yeah, the Babylon.Ray is a nice in-code PG search term, or forum search term.  Perhaps you could dig-up some ray -> mesh tests that others have done.  For the in-code playground (PG) searcher... you can wrap things in double quotes of double quotes.  :D

For example, " "path" "Babylon.Ray" "intersectsMesh" "

That should search thru all playgrounds for occurrences where record contains ALL those terms. (experiment to be sure.)  There might be some interesting code to be found.

Link to comment
Share on other sites

Thank you for suggestions Wingnut. I guess I should look playground examples :)

P.S. We are using FollowCamera, and it is looking to the ground object all the time, so all moves can be seen on the screen. I did consider that one time we can change the lock to the cat or rat when they move, and after go back to ground. Maybe we should do that :)

Link to comment
Share on other sites

@Shadow95 -

I'm not completely clear on what you are trying to do... and I applaud @Wingnut for attempting to help when it's not clear as to what the specific goal is in registering distance between objects - as perhaps the camera comes into play as well? There's just not enough info here to assist. But if you can build a simple playground example, then many of us can provide you with varying solutions - as if I might understand what you are trying to do then there are several methods which might be applicable. However, I have no clue until it's clear as to what the end goal is.

DB

Link to comment
Share on other sites

On 11/4/2017 at 12:46 PM, Shadow95 said:

How can I get the distances to obstacles which provided with some decided angle of view.

Vector3.Distance(value1, value2)?  It's the distance in Euclidian space, so you don't need an angle.  ie: check from camera position to top of mesh for rat/cat?  To get if an object is in "sight" and you can't actually see it then you could use a second camera pointing forward that is not displayed and check the camera frustrum?

http://www.html5gamedevs.com/topic/28714-camera-frustum/, which basically is this:

var frustumPlanes = BABYLON.Frustum.GetPlanes(camera.getTransformMatrix());
mesh.isInFrustum(frustumPlanes)

Another idea if you have a second camera is that you could hide some obstacles with layer mask to see through walls, etc, if needed:
https://doc.babylonjs.com/classes/3.1/camera#layermask-number

Cool project - hopefully that helps a bit.  I wrote device drivers for laser range finders, so I understand the concept just not what you are missing :)

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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...