mirror of
https://github.com/Project-Redacted/project-hampter.git
synced 2025-05-31 15:53:15 +00:00
Update :3
This commit is contained in:
parent
1f50b3f262
commit
6bbd56a5cf
759 changed files with 269694 additions and 37600 deletions
37
Assets/Key/KeyScripts/Move.cs
Normal file
37
Assets/Key/KeyScripts/Move.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
//using UnityEngine;
|
||||
|
||||
//public class Move : MonoBehaviour
|
||||
//{
|
||||
//public float rotationSpeed = 50f;
|
||||
|
||||
// Update is called once per frame
|
||||
// void Update()
|
||||
// {
|
||||
// transform.rotation = Quaternion.Euler(0f, transform.rotation.eulerAngles.y + (rotationSpeed * Time.deltaTime), 0);
|
||||
// }
|
||||
|
||||
//}
|
||||
using UnityEngine;
|
||||
|
||||
public class Move : MonoBehaviour
|
||||
{
|
||||
public float rotationSpeed = 10f;
|
||||
public float movementSpeed = 1f;
|
||||
public float movementRange = 1f;
|
||||
private Vector3 startPosition;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
startPosition = transform.position;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Rotate the object around the Y axis at the specified speed
|
||||
transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime);
|
||||
|
||||
// Move the object up and down within a specified range
|
||||
Vector3 newPosition = startPosition + new Vector3(0, Mathf.Sin(Time.time * movementSpeed) * movementRange, 0);
|
||||
transform.position = newPosition;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue