Controlling Position
This commit is contained in:
13
Assets/Scripts/MovingSphere.cs
Normal file
13
Assets/Scripts/MovingSphere.cs
Normal 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);
|
||||
}
|
||||
}
|
11
Assets/Scripts/MovingSphere.cs.meta
Normal file
11
Assets/Scripts/MovingSphere.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50beb4685c906ba49b7db3438cc30dfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user