Forum Discussion
L4Z3RC47
8 years agoProtege
Custom Float Controller
I'm currently working on a custom controller implementation based on the existing OVRPlayerController. In this setup the player is situated in a floating space. Basically what we need to do is elimin...
kojack
8 years agoMVP
L4Z3RC47 said:
1: The player only moves up and down if the primaryAxis is triggered and thus also moving the player left right forwards or backwards
In the code snippet you posted, the amount of up/down movement is being scaled by the primaryAxis.y (forward/back) value. I'm guessing this should be the secondaryAxis.y instead.
Also in the snippet, the top check (for down) uses MathF.Abs to force the primaryAxis.y to be positive. But the check for up is missing the Abs call, so if you are moving backwards then primaryAxis.y is negative, that is being multiplied by the up vector to make it a down vector.
L4Z3RC47 said:
2: Up and down on the secondary axis seems to be changing the forward/backwards vector rather than propelling the player itself, so if you move backwards by pulling back on the primaryAxis.y while setting the vector to up with the secondaryAxis.y you move backwards and down rather than backwards and up.
Try this:
- if (secondaryAxis.y < 0.0f)
- MoveThrottle += ort * (Mathf.Abs(secondaryAxis.y) * transform.lossyScale.y * moveInfluence *
- BackAndSideDampen * Vector3.down);
- if (secondaryAxis.y > 0.0f)
- MoveThrottle += ort * (Mathf.Abs(secondaryAxis.y) * transform.lossyScale.y * moveInfluence * BackAndSideDampen *
- Vector3.up);
What I would probably do is cut that down to just one check like:
MoveThrottle += ort * secondaryAxis.y * transform.lossyScale.y * moveInfluence * BackAndSideDampen * Vector3.up;
If secondaryAxis.y is negative, then it reverses the up vector naturally.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 21 days ago
- 3 days ago
- 8 months ago