Download

How do I set the dimensions of a mesh based on the chaperone bounds

I figured out how to spawn meshes in the location of the corners of the chaperone bounds (in blueprints), but I would like to spawn one mesh and have it’s dimensions be based on where those corners are. Basically, I want the floor to be exactly the size of the chaperone area.

I can’t find any way to edit the dimensions of a mesh in blueprints, or pass coordinates to a mesh. Is this possible?

You generally don’t want to edit the dimensions of a static mesh as they are supposed to be that “static”. You can use a procedural mesh component to manually add vertices to a custom mesh (but this is more of an advanced feature so I wouldn’t recommend it for someone getting started).

The easiest way to solve your problem would be to simply scale your floor mesh to fit the chaperone. To do this you first need to know the base dimensions of your floor (something like the Cube primitive in UE4 is 100x100x100) you can then normalise those dimensions to the chaperone bounds. like if your user has a bounds with dimensions 100x100 you won’t need to do any scaling if you’re using the cube mesh, but if they have a chaperone of 200x200 you will scale the cube by 2x (chaperone size/cube size = 200/100 x 200/100 = 2x2).

This can be done by first finding the bounding box for the chaperone (by looping over the bounds and finding the min and max) then finding the bounding box of your floor (there’s a blueprint node for this). Then simply dividing them by each other.

like this:

c588bbd7254624e71225d98f27c98ae32d7af7b4.png

Anyway here’s an example Blueprint of how to do it:
https://drive.google.com/open?id=0B6lHn83hV_KOR1hlM3dFTHlzYXM
It’s the one that is in my VR Content Examples

Thank you!!! I had figured out a solution after I posted this and should have responded, but I like yours more so I’m glad I didn’t. I didn’t use min and max (just the array indices) and I think actually I need to, and, in general, your solution is much cleaner. I didn’t know about the “Set Actor Scale 3D” node so I spawned a basic cube as a replacement for the floor and passed it a transform that had scaled x and y axes on spawn, which means lots of breaking and making of transforms and vectors, which turns into spaghetti. This is more elegant.

Hi -
Can you let me know what version of Unreal you are using and does it matter if it is a VR template or not ?
Is there anyway to maintain the new dimensions of the scaled cube in editor mode (so it can be used as a reference ?)
Is there anyway to get the cube to rotate so as the corners align with the base of the chaperone corners or should this be happening automatically ?

UE4 version shouldn’t matter as long as it’s greater than 4.11
No VR Template needed
I’m not sure if you can access the chaperone bounds in the construction script which is what would be needed to do it in the editor
The initial Pawn rotation on begin play is the forward direction of the chaperone, use that to get the needed rotation

So if the chaperone bounds can’t be viewed in the editor how can virtual objects be placed in the same position as physical props within the defined vive play area ? There doesn’t seem to be anything on the forum about this but surely it is something that people must have implemented so far ?

There is no real “defined play area” as every user defines there own play area so therefor it doesn’t make too much sense to place objects statically in the editor to fit your play area as other users might have a completely different room shape/size.

I think some projects do rely on predefined permanent play areas. For example The Void (https://thevoid.com/) uses virtual models mapped on to the location of basic wooden props to give more realism through tangible objects and haptic feedback.
In my case I want to perform user tests by getting volunteers to walk around a defined border in a room (ie the chaperone bounds). I want to compare physical output in an immersive environment and in a non-immersive environment…so I kind of need to get some synchronization between the virtual and real borders.
Very surprised that the bounds can’t be enabled as visible in edit mode via the preferences - I would have thought there was a demand for such a feature and that it could be easily implemented by the design team.

In the case of The Void they don’t use steam VR so no chaperone, as for your case if you’re only targeting your experience to one physical space then there is no need to use the chaperone, simply measure out your space and add the appropriate walls in the engine (don’t forget 1 Unreal Unit is 1cm), if you want to measure your space with SteamVR (so you don’t have to do it manually) you can actually get the chaperone points in the SteamVR developer menu. To me the use case of chaperone is a way for developers to get access to the varying users play sizes if your creating a tailored experience (maybe something like an out of home entertainment thing like the void) then chaperone isn’t really needed

I managed to get the measurements from the developer window and used the geometry editing mode in unreal to create a polygon that fits the dimensions of my play area.
It fits roughly inline with the coordinates of the camera (in the vr template in 4.14) but I manually adjusted the scale and position to get the alignment matching up better. Is there any faster way to sync up the placement of the mesh ?

Where do you have this information from?
Do we speak of the same setup? I’m using vive basestation 2 for tracking. I don’t think the rotation of the chaperone changes because its static and base tracks the location and rotation of the headset. I think for basestation 1 it’s the same.
But how do I get the rotation of the chaperone so I can pass it to the floor?

I figured out, that if I use location 0,0,0 for the floor which has the same size like the real room everything is fine, except the rotation. It seems that the roation is twisteb by 20 %. If I roatete the floor (z) by 20 % everything is ok, the chaperone fits to my floor. can someone confirm that? Perhaps the rotation of the chaperone is different in every steamvr setup, I don’t know.