Linking Trigger to Input (or directly into Character Control script)
**I have created an AR array using Vuforia that will move a placeholder relative to the camera's position (when the user moves the camera). I have attached this placeholder to a collider object, which is surrounded by barriers, which are triggers. I want to substitute the triggers as button inputs for the character controls.
The idea is allow the player to cause their character to maneuver in the (FPS) game by changing the position of the camera forward, backwards, left, and right (relative to a marker). For a VR headset equipped with a camera, this will allow the player to control a character by making small movements of their body, for more immersive play.
In the script that comes with the FPS Rigid Body Character Controller (Standard Assets, Unity 5.0), I think I've found the reference to the input controls:**
public void UpdateDesiredTargetSpeed(Vector2 input)
{
if (input == Vector2.zero) return;
if (input.x > 0 || input.x < 0)
{
//strafe
CurrentTargetSpeed = StrafeSpeed;
}
if (input.y < 0)
{
//backwards
CurrentTargetSpeed = BackwardSpeed;
}
if (input.y > 0)
{
//forwards
//handled last as if strafing and moving forward at the same time forwards speed should take precedence
CurrentTargetSpeed = ForwardSpeed;
}
**I believe I need to replace the "if (input.y < 0)" with a reference to the trigger that is in front of the collider object, which the player is moving around by moving the camera. I don't really know how to do that, which I'll come back to at the end.
Likewise, the "if (input.y < 0)" should be replaced with a reference to the trigger behind the collider object.
I'm not sure what to do with the side-to-side part, though: they changed up the syntax somehow and made that control "if (input.x > 0 || input.x < 0)"
So I have two problems.
1) How do I put a reference to the trigger (did the placeholder collide with the particular barrier) into the Character Controller script, and
2) How do I deal with the x-axis input, I have no idea what to do with this departure from the previous format...this is kind of a minor side question...please help me with #1, primarily!**