Skip to content

Instantly share code, notes, and snippets.

@QRemark
Created August 1, 2024 16:20
Show Gist options
  • Select an option

  • Save QRemark/c7188c75ae3025634f685081128b2ad7 to your computer and use it in GitHub Desktop.

Select an option

Save QRemark/c7188c75ae3025634f685081128b2ad7 to your computer and use it in GitHub Desktop.
Трансформации
using UnityEngine;
public class Move : MonoBehaviour
{
[SerializeField] private float _speedForward;
private void Update()
{
ChangePosition();
}
private void ChangePosition()
{
transform.position += transform.right * _speedForward * Time.deltaTime;
}
}
using UnityEngine;
public class Rotate : MonoBehaviour
{
[SerializeField] private float _speedRotation;
private void Update()
{
ChangeAngle();
}
private void ChangeAngle()
{
transform.Rotate(Vector3.up, _speedRotation * Time.deltaTime);
}
}
using UnityEngine;
public class Scale : MonoBehaviour
{
[SerializeField] private float _speedScale;
private void Update()
{
ChangeScale();
}
private void ChangeScale()
{
var nextScale = transform.localScale;
nextScale += Vector3.one * _speedScale * Time.deltaTime;
transform.localScale = nextScale;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment