using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using UnityEngine;
|
using System;
|
|
|
namespace vnxbqy.UI
|
{
|
|
public class CoinMass : MonoBehaviour
|
{
|
[SerializeField] Rigidbody rigidObj;
|
private void LateUpdate()
|
{
|
if (this.transform.localPosition.z >= -2)
|
{
|
rigidObj.mass = 80;
|
}
|
else if (this.transform.localPosition.z <= -2.4f)
|
{
|
rigidObj.mass = 1000;
|
}
|
else if (this.transform.localPosition.z > -2.4f && this.transform.localPosition.z < -2f)
|
{
|
rigidObj.mass = 80 + 1/(2.4f + this.transform.localPosition.z + 0.01f)*10;
|
}
|
|
}
|
}
|
}
|
|