Unreal Engine blueprint node and pin extension - unreal-engine4

I am new to Unreal Engine and was trying to customize my own blueprint according to some tutorial online. However, I did not know which function to call when trying to extend a node and a pin. What I am trying to achieve is as below:
There are 2 parts here that I could not figure it out.
How to extend the "Handle Location" variable, so that I could obtain the X:0, Y:0, Z:0 box as seen above?
How to create the pin extension box, where one node is able to connect to another 2 nodes?

Both of those boxes you highlight above are Vector Addition nodes. If you drag off a Vector pin, you should be able to search for "vector + vector" in the search box that appears!
It looks like this:
Generally, when you drag off a pin, the box that appears will contain all the usual things you can do with a pin of that type. The search box is also quite smart, if you type "vector add" instead of "vector + vector," you will still get the vector + vector result!
Good luck!

You cannot extend a node pin. Pin is either an output or input. What you probably wanted to say is "split struct pin". You can do that by right-clicking on that particular pin and choosing "split struct pin". To reverse this, you can do the same and choose "recombine struct pin". For vectors, you can drag out the pin and choose "break vector" node in the node search. Similarly for rotators, "break rotator".
In short, click on an empty space in the same blueprint and search for "Get Handle Location". This gives you the reference to the vector you want to access. Then, drag the yellow pin and search for "break vector". Now you can access each axis location separately.
Keep in mind that you cannot access any variable of any blueprint in the game just by searching for it. Here you can because it is in the same blueprint. Otherwise, you need to make blueprints communicate together.

Related

Best way to create an interactive map using an existing image

I'm trying to create an interactive world map like in Europa Universalis IV or Crusader Kings II using Unity3D. These two games create the map using an existing image (like this https://i.imgur.com/y2gtX2N.png). I have never done something like this before and I'm really confused on which is the best approach/technique to use.
What I need is an idea on how to show the map and be able to select every single province taken from the image.
My method would require you to provide each region as an individual sprite.
1) Add all sprites to the scene and form the world map (SpriteRenderer or UI.Image).
2) Make a Component that handles interaction, and add it to each World Map Part GameObject.
Implement the following interfaces to it, and specify the logic accordingly:
3) Add the Polygon Collider 2D Component to each World Map Part GameObject.
4) Add the Physics Raycaster 2D Component to your Camera.
If you choose to use UI.Image (which I do not recommend), you can skip steps 3 and 4, and instead set alphaHitTestMinimumThreshold to 1 on your World Map Part Component's Awake().

How can I change hand-rays in my MRTK v2 project for HoloLens 2 to parabolic instead of linear?

My HoloLens 2 project has content that is arranged as such I cannot target colliders with the existing hand-rays. I used to target my content with the head-gaze, but with hand-rays being lower on the body it is more difficult to reach the content that I want to select. I believe I would benefit from a parabolic selection ray, similar to those used when teleporting in Mixed Reality to reach surfaces above the participant.
The primary method of interacting with my content would be via a parabolic ray. There are instances within my application where I might change modality to focus on a menu system from close or far, and when I am far I'd like to change to a linear ray. So, having this capability to change the type of ray exposed via code would be preferred.
My project is employing the MRTK v2, and the standard linear hand-rays are functioning.
I would like to be able to change the type of ray being used in the Unity inspector, and to be able to change the style via code during run-time. I'd like to have control over the arc of the ray, as the scale of my content may impact the need for a different arc and min/max distance.
You can modify the DefaultControllerPointer prefab to use a Physical Parabolic Line Data Provider instead of a Bezier Line Data provider. This will distort the line used by the pointer to be more parabolic.
Before:
After:
Note that I removed the pink components and added the green components.
You will also want to increase the line cast resolution of the pointer from 2 to something larger, this means that the ray used to query what you have hit will have higher resolution:
And you may want to increase the resolution of the MR Line Renderer itself.
Demo of parabolic hand pointer:

finding submesh in Unity 2017

How can I find submesh under my mouse NOT using Raycasting? Is any way to do it? I know how to do it clicking on object and using raycast but completely haven't idea how to id it without it. I need it because of bug in Unity - I can't update version of Unity, so I need to find any solution.
You can see if your mesh contains the mouse.
You get the position and the size of the mesh which allows you to create a square or a cube (whichever you need) and then you just see if your mouse fits within that square or a cube. If so, then you want to select that mesh.
https://tutorialedge.net/gamedev/aabb-collision-detection-tutorial/
or
If your object was a circle/sphere then you can perform a simple distance check between mesh's origin and mouse, if the distance is <= than the radius of the object, then you want to select that mesh.
http://cgp.wikidot.com/circle-to-circle-collision-detection
It is similar, just instead of using 2nd object, you are using a mouse.

Setting area for BlobAnalysis in Matlab

I am using this example from a Computer Vision Made Easy" Matlab Webinar I watched, since I intend to use Computer Vision for my research in order to count cars and/or other types of vehicles.
Although I have changed some of the filter parameters and the detection works quite well, the problem is that the script displays ALL moving objects in the video. I would like to count vehicles from a specific road but my video screenshot includes many roads (screenshot here).
1) Is there a way to set the area of the video that I would like to detect cars? For example, only the "green arrow" road, and leave out the rest? I tried to crop the video but it is not a good solution since a part of another road always appears(screenshot here).
2) Moreover, in which part of the code can I add a counter in order to have an output on how many vehicles passed through the specific segment of the road? Any ideas on that?
If you know ahead of time where the road is, you can create a binary mask image, where the road is marked with 1's, and everything else has the value of 0. Then you can simply check whether or not a moving object is inside your region of interest.
Once you get comfortable with this example, check out a more advanced version, which not only detects moving objects, but also tracks them using the Kalman filter.

Change annotations inside MapKit view

I have a lot of annotations to manage inside the mapkit view.
The rules are :
1 -only show annotations when the mapView.region.span.longitudeDelta is above 0.042
2 -only show annotations inside the visible area.
3- remove the annotations when they comes out the visible area...
How I can do that ... Share your experience...
Thanks
You need a few things. One is to search your database for the pins with latitudes and longitudes inside the map's view. This is called a bounding box. The next is to remove the annotations when they move outside the visible rect of the map. Each time the map is moved, you'll have to recalculate what pins are in the box and what pins are outside but still on the map.
One hint I can give you is to divide the visible rect of the map into squares (maybe 17 x 23 squares of 20 x 20) and figure out if a pin goes into that square. If it does, mark that square as filled, and if another pin wants to go into that square, don't let it. This will allow you to filter the pins so there aren't too many on screen at one time.
It's not an easy problem, but if you do some search around you'll find your way through it. This cluster marker code for Google Maps might help.