mirror of
https://udrimavric.com/MAVRIC/Stratasys-450mc-VR.git
synced 2025-01-22 23:28:43 -05:00
28 lines
870 B
C#
28 lines
870 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
public class ScaleTarget : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform target;
|
|
|
|
[SerializeField] private float minScale = 1f;
|
|
[SerializeField] private float maxScale = 2f;
|
|
|
|
[SerializeField] private Vector3 scaleAxis = Vector3.right;
|
|
|
|
[SerializeField] private float speed = 1f;
|
|
|
|
public void Scale(float value)
|
|
{
|
|
target.localScale += scaleAxis * (value * speed * Time.deltaTime);
|
|
var clampedScale = target.localScale;
|
|
clampedScale.x = Mathf.Clamp(clampedScale.x, minScale, maxScale);
|
|
clampedScale.y = Mathf.Clamp(clampedScale.y, minScale, maxScale);
|
|
clampedScale.z = Mathf.Clamp(clampedScale.z, minScale, maxScale);
|
|
target.localScale = clampedScale;
|
|
}
|
|
}
|