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.

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.

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.

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

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.

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?

Glad it works!

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

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

Thank you for all the help! Much appreciated!

Only the z measurement, from 0. Using trace.

Thank you!

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.

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

Hi Everyone,

Here is a new YouTube video depicting the process:

Ta

J