Controlling Position

This commit is contained in:
2021-02-01 18:10:45 +08:00
parent 4981c397c0
commit ea974fca0d
11 changed files with 723 additions and 20 deletions

View File

@ -0,0 +1,13 @@
using UnityEngine;
public class MovingSphere : MonoBehaviour
{
private void Update()
{
Vector2 playerInput;
playerInput.x = Input.GetAxis("Horizontal");
playerInput.y = Input.GetAxis("Vertical");
playerInput = Vector2.ClampMagnitude(playerInput, 1f);
transform.localPosition = new Vector3(playerInput.x, 0.5f, playerInput.y);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50beb4685c906ba49b7db3438cc30dfc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: