1
This commit is contained in:
33
Assets/Plugins/Trails FX/Demo/Scripts/MoveObject.cs
Normal file
33
Assets/Plugins/Trails FX/Demo/Scripts/MoveObject.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace TrailsFX.Demos {
|
||||
|
||||
public class MoveObject : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
void Update ()
|
||||
{
|
||||
Rigidbody rb = GetComponent<Rigidbody> ();
|
||||
if (rb == null)
|
||||
return;
|
||||
|
||||
Vector3 direction = Vector3.zero;
|
||||
if (Input.GetKey (KeyCode.A)) {
|
||||
direction = Vector3.right;
|
||||
}
|
||||
if (Input.GetKey (KeyCode.D)) {
|
||||
direction = Vector3.left;
|
||||
}
|
||||
if (Input.GetKey (KeyCode.W)) {
|
||||
direction = Vector3.back;
|
||||
}
|
||||
if (Input.GetKey (KeyCode.S)) {
|
||||
direction = Vector3.forward;
|
||||
}
|
||||
rb.AddForce (direction * 10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user