I am working on path planning, and I have performed path smoothing for the initial path generated from RRT-connect algorithm. However, the resulted smoothed path is colliding with the obstacle. The question is that "How to perform a collision detection and then locate the collide segment and add a point in the middle of that segment?"
Related
Consider the following situation.
There is a predefined area inside NavMesh that AI agent must reach. For convenience - it is circular area.
To find the closest point of the area is pretty straightforward task. No, I need to find the shortest path to an area.
In the picture example the closest point obviously requires from an agent to travel further than optimal distance is.
So, how to calculate desired destination point in such situation?
Do I have to implement a wave propagation algorithm myself? Use the A* instead of built-in NavMesh? Are there any simple solutions involving Unity3D tools?
Note: desired area is just an abstraction defined by (Vector3) position and (float) radius, not an actual object in game scene.
Note : I am coding in Unity, using C# script. I cannot use trigger hit detection using Raycasting because there are a lot of trigger colliders in between the target and source which detect touches and the sort. So the ray hits the other triggers before even reaching it's target, which is not desirable.
What I want to accomplish basically is return a boolean value if a vector line crosses or intersects a particular set of vector coordinates or an area.
For example: Detecting a laser entering into a fog in between it's path when shooting at it's target. The fog is a trigger collider based game object.
Edit: Another example would be to check if a line crosses a 2D box area in a 2D graph. Keep in mind, I cannot use collision detection or Raycast hit here.
There is no need for code, just explain the concept of how it could be accomplished. Though a code snippet is also welcome. Thankyou!
[...] So the ray hits the other triggers before even reaching it's target, which is not desirable.
What about putting that on Layers? You can specify LayerMasks for Raycasts.
You could consider the edges of the 2D box as lines i.e 4 lines and check for intersection of a line with these 4 edges using line to line intersection technique. If the line however is small enough to fit inside the box, and you want to treat it as a valid intersection, then check if the two points of the line is inside the bounds of the box.
I added impulse to GameObject like
rigidbody.Addforce( SomeVector3, ForceMode.Impulse);
and my gravity multiplier is 4. How to calculate points of my path before I apply that impuls on body ?
I have all data like mass, gravity multipiler and so on and I would like to draw that path before apply impulse so I need number of points.
Using common physics you are of course able to predict the path the object will go. The problem is, your formulas, ticking etc. will most likely not exactly be the same as the ones Unity uses internally, so your results won't be exact.
Only thing I can think off is having a second, invisible, version of your GameObject and apply the impulse to it and track its position, then display the resulting path for your visible GameObject. You might consider accelerating Unity's time using Time.timeScale during prediction, so you don't have to wait too long for the simulation's results.
Which Matlab functions or examples should be used to (1) track distance from moving object to stereo (binocular) cameras, and (2) track centroid (X,Y,Z) of moving objects, ideally in the range of 0.6m to 6m. from cameras?
I've used the Matlab example that uses the PeopleDetector function, but this becomes inaccurate when a person is within 2m. because it begins clipping heads and legs.
The first thing that you need deal with, is in how detect the object of interest (I suppose you have resolved this issue). There are a lot of approaches of how to detect moving objects. If your cameras will stand in a fix position you can work only with one camera and use some background subtraction to get the objects that appear in the scene (Some info here). If your cameras are are moving, I think the best approach is to work with optical flow of the two cameras (instead to use a previous frame to get the flow map, the stereo pair images are used to get the optical flow map in each fame).
In MatLab, there is an option called disparity computation, this could help you to try to detect the objects in scene, after this you need to add a stage to extract the objects of your interest, you can use some thresholds. Once you have the desired objects, you need to put them in a binary mask. In this mask you can use some image momentum (Check this and this) extractor to calculate the centroids. If the images in the binary mask look noissy you can use some morphological operations to improve the reults (watch this).
Is there a way to create a lightning effect on the iPhone using opengl?(like this app)
Right now I have modified the glpaint sample to draw random points around a line (between two points that the user touches) and then connecting them, but the result is a zigzag line that constantly jumps around and lags horribly on the actual device.
you'll probably just want to make a triangle strip from the center of the device to the point that is being touched, then apply a drawn lightning texture to that resultant polygon.
You can animate the texture in order to get the jumping lightning effect.
A simple way to create a lightning effect is to compute the lightning path using a 2D Perlin function, rendering it to a glow buffer, blurring it with a Gaussian blur shader, and merging it with the scene. You can make the lightning move by computing two paths (start and end) with an identical number of path nodes and moving each node of the start path successively towards the corresponding node of the end path. Once the end path has been reached, it becomes the start path and a new end path is computed.