Move plane horizontally using 2D controller
Have map on plane on floor. Trying to use Bluetooth clicker to "walk" the map from static camera perspective. In other words, when rotating clicker I'd like map to move not camera. Clicker provides x, y offsets, which is fine because map.y location is static, so am substituting clicker.y offset to represent map.z changes. Here's what I have so far which relatively works, but not as desired. Believe there's a better way.
void NavigationUpdatedEvent(InteractionSourceKind source, Vector3 normalizedOffset, Ray headRay)
{
float x = 0.5f;
float y = map.transform.position.y;
float z = 0.5f;
if(normalizedOffset.x < .5)
{
x *= normalizedOffset.x + .5f;
map.transform.position += Vector3.left * x;
}
else
{
x *= normalizedOffset.x + .5f;
map.transform.position += Vector3.right * x;
}
if(normalizedOffset.y < .5)
{
z *= normalizedOffset.y + .5f;
map.transform.position += Vector3.forward * z;
}
else
{
z *= normalizedOffset.y + .5f;
map.transform.position += Vector3.back * z;
}
}
Your answer
Follow this Question
Related Questions
Trying to Generate Different Random Values for Position of Game Object Instances [C#] 1 Answer
Need help with multiple updating transform positions 2 Answers
Terrain height -> loosing Players GO childs 0 Answers
Animation transition problem 1 Answer
How would someone go about creating multiple triggers in one script 0 Answers