x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Measuring height at VR traced level

This is for ArchViz. BasicallyI need an in-game measuring tool setup. I want to measure the walls the in the room. With the help of a controller or just by eye trace, when I look at a point on the wall I want the height to be shown from the floor level(or from 0 of grid), just the height no other co-ordinates.

Product Version: UE 4.18
Tags:
more ▼

asked Nov 14 '17 at 08:41 AM in VR

avatar image

ebes
12 5 6 10

(comments are locked)
10|2000 characters needed characters left

5 answers: sort voted first

Just take the difference between the Z coordinate of the hit point on the wall and the Z coordinate of the floor mesh (subtract its thickness if needed), divide it by 100 and that is the height in meters of the hit point on the wall respect to the floor level. Unless you changed the world scale, 1 Unreal Unit is 1 cm.

more ▼

answered Nov 14 '17 at 12:29 PM

avatar image

vr_marco
2.2k 10 6 12

avatar image ebes Nov 15 '17 at 02:50 PM

avatar image vr_marco 22 hours ago 1 Yes it is perfectly possible:

In your VR Pawn, create a boolean variable bMeasureOn to turn the measuring function on/off, I don't think you want it on all the time. Make it True for the moment, later you could use a key to toggle it.

From the Event Tick in your VR Pawn, check if the bMeasureOn variable is true with a branch. If it is, continue to 3.

Do a Line Trace by Channel, starting from the current VR Camera position and along the VR Camera Forward Vector for enough units to hit the walls around (say 500 UU = 5 meters). I assume you know how to properly do a line trace.

With a Branch, check the Return Value pin of the Line Trace by Channel output to make sure you have hit something

If the Return Value pin is true (meaning you have hit something), use Break Hit Results to break the content of the Out Hit pin

Extract the Impact Point --> Break Vector --> Take its Z coordinate

Since the height of the floor is 0, this is the height of the impact point in cm above the floor

Divide the Z coordinate by 100 to have the height in meters

That's pretty much it. If you want to limit the measurement to walls, you can tag their meshes with a special tag and then use the Actor Has Tag node to check whether it is or not a wall.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/ActorHasTag/

(comments are locked)
10|2000 characters needed characters left

You will need to find the point that a line trace hits your object (A wall) and then use the hit location Z as the height. If you have setup all scales and are using Unreal's default world scale, then 1 Unreal Unit is 1 cm.

You can also use the same principal with your controller. Get the Z location of your controller, and assuming that the floor is at 0, then the controller Z is the height in CM from the floor.

more ▼

answered Nov 14 '17 at 02:27 PM

avatar image

Dune
1.9k 52 39 200

avatar image ebes Nov 14 '17 at 02:44 PM

Is this possible using blueprint? Can you please explain how...

avatar image ebes Nov 15 '17 at 07:47 AM

alt text

123456.png (205.9 kB)
avatar image vr_marco Nov 15 '17 at 09:25 AM

Looks good to me, except you are not dividing the hieght by 100, so it will be in cm rather than in meters. Does it work as expected?

avatar image ebes Nov 15 '17 at 09:53 AM

This is to conversion in mm with subtraction for floor thickness.

Thank you for all the help! Much appreciated!

(comments are locked)
10|2000 characters needed characters left

Only the z measurement, from 0. Using trace.

more ▼

answered Nov 14 '17 at 02:45 PM

avatar image

ebes
12 5 6 10

avatar image vr_marco Nov 14 '17 at 04:32 PM

Yes it is perfectly possible:

  1. In your VR Pawn, create a boolean variable bMeasureOn to turn the measuring function on/off, I don't think you want it on all the time. Make it True for the moment, later you could use a key to toggle it.

  2. From the Event Tick in your VR Pawn, check if the bMeasureOn variable is true with a branch. If it is, continue to 3.

  3. Do a Line Trace by Channel, starting from the current VR Camera position and along the VR Camera Forward Vector for enough units to hit the walls around (say 500 UU = 5 meters). I assume you know how to properly do a line trace.

  4. With a Branch, check the Return Value pin of the Line Trace by Channel output to make sure you have hit something

  5. If the Return Value pin is true (meaning you have hit something), use Break Hit Results to break the content of the Out Hit pin

  6. Extract the Impact Point --> Break Vector --> Take its Z coordinate

  7. Since the height of the floor is 0, this is the height of the impact point in cm above the floor

  8. Divide the Z coordinate by 100 to have the height in meters

That's pretty much it. If you want to limit the measurement to walls, you can tag their meshes with a special tag and then use the Actor Has Tag node to check whether it is or not a wall.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Utilities/ActorHasTag/

avatar image vr_marco Nov 15 '17 at 10:08 AM

Glad it works!

Forum Etiquette Note: you should have accepted my original answer above and not your own reply to it.

avatar image ebes Nov 15 '17 at 02:51 PM

Mybad. I have made the changes. I am just getting started here, my apologies.

(comments are locked)
10|2000 characters needed characters left

Thank you!

more ▼

answered Nov 15 '17 at 09:54 AM

avatar image

ebes
12 5 6 10

(comments are locked)
10|2000 characters needed characters left

alt text

capture.png (116.0 kB)
more ▼

answered Nov 15 '17 at 09:52 AM

avatar image

ebes
12 5 6 10

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question