For Vive, we can use it normally. The sport tracking function is a highlight of HTC Vive. It also makes many games that adapt to HTC Vive to make users move. It sounds cool and cool to experience. In a game where the movement of a small range of 1:1 is active or in a fixed position, the positioning is accurate, and the delay is low, and various advantages are achieved.
However, the space issue makes the players who want to play in the small space scenes out of the door. HTC's official advice: HTC recommends that consumers use a full set of equipment in at least 20 square meters of space, which also means that your game room should be large enough. . Tyrants do not have to look down!
However, for the users who want to open up the soil, in practice, the site size becomes a limitation. The user does not have the exact size of the game scene, the playing field is too large, and the player’s space is too small. How to solve it? :1 The venue, there will be a kind of game scene is very cramped, it feels not to go far to the margin, so that players are very unhappy.
So here's a solution to the problem of moving the HTC helmet in space than space. Of course, if you have a better way, welcome the discussion.
We focus on the fact that the game scene is too large, but the actual venue is small, and it needs to accelerate the displacement.
We have three problems to solve:
Border magnification
2. Starting position translation
3. Game space and site non-equal space velocity scaling
I. Boundary magnification
First, take a look at the top view of the official SteamVR's preform:
Found no, in the HTC helmet game, players are always in the middle of the blue box. For a game that needs to start from (0,0) as a starting point, you need to move around in the room, and depending on the game story, a game that requires space to move can only use one-fourth of the original site, which will cause more. The waste of the venue.
The first thing we solve is the problem of positional offset.
Second, see the size of the blue border. In fact, the blue box is very small
Look at the code:
This area is small, does not meet the demand, how to do it? To increase their own ah, engage in large venues!
I made a regional identity myself.
The small blue box is its original 400300, and the big one is my own zoom area.
Select Size for the Calibrated option and zoom. A parent node has been specifically added to prevent zooming out on direct nodes. Xz scales to 4 and Y remains at 1.
This logo basically satisfies a large venue with 99 meters of floor space in the game.
Second, the starting position translation
All right. Now back to the question of translation of the starting point.
In two parts:
One is visually, that is, in the game editor mode, let the player be in the starting point position of the blue area. This is easy, it is still translation. Who to translate, translate the blue area, and translate the parent node of the prefabricated body that was just zoomed. The translation position in the item is (4.2, 0, 4.2). This part is done.
The second part is more tedious.
Before talking about this issue, it is necessary to say a bit about the difference between the runtime and editing status of the SteamVR plug-in camera.
This is the camera status in editor mode.
However, at the time of operation, the camera's hierarchical structure will undergo major changes.
You can see that eye is the parent node, ears is the child node, and the head is hidden.
The specific code processing is handled in OnEnable in SteamVR_Camera.cs.
Part of the code:
There are ear's processing code, set the ear's camera parameters:
Why did you say so many structures? Because it affects the player's starting point translation algorithm and processing. How to deal with it?
It is actually quite simple. When the parent node of the camera is initialized, it resets a parameter that is opposite to the camera initialization. Why? This is to counteract the camera's change from the (0,0) point in the scene.
Specific code:
This button and time are automatically started according to your needs. You can't use the buttons to do this.
Incidentally, here is: To add a handle, just put the handle script under this node, and then set the left and right handles. The handle will not be affected by the acceleration of the displacement in the following.
Third, the game space and venue non-equal space speed zoom
Well, I finished the translation. Finally, that is, the scene is 99 meters, and my site is only three meters or five meters, what to do? In fact, the results have become more apparent. It is just that FPSController has a scaled parent node.
Can someone disagree? Directly controlling the HTCvive camera's script to modify and scale the resulting camera position is not it? Well, this method is really good. However, it cannot be achieved. why?
Because the camera cannot be controlled at the script level. Under the editor running model, all the script code is checked out, and the camera's position rotation can also be used normally. This basically shows that there is little opportunity for the camera to control the script layer. However, I do not give up. Here are a variety of attempts.
Of course, in the script, look at the code.
It should be said that the above code has no effect on the camera settings of the HTC helmet. To see clearly is any effect on the actual effect.
To say that it works, in the editor mode, the reality in the editor is zero, but the camera data can still change. This is because the data display of the editor is prior to the real camera coordinates, it is just an illusion and it is an illusion.
The final solution, add a parent node to FPSController, so basically get it.
In order to facilitate the adjustment of the match according to the size of the venue and the size of the game scene, a configuration file was made for the zoom parameter. There is no more detail here.
At this point, we have completed the boundary zooming, the starting point position translation, and the non-equal space velocity scaling of the game space and the venue.
By the way, when we have a game scene of 99 and the actual test site is about 2.5 meters, the zoom factor is 0.5. This is due to the site being too small and having too little speed to be uncomfortable. In the 55 or so, adjusting the parameters, the overall feeling is still very comfortable, there is no feeling of cramped in the game because of the size of the space.