mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-26 19:43:01 +00:00
Trick on the Class: object rotation
This commit is contained in:
parent
3b2b4d6861
commit
0ee7e73a0c
1 changed files with 15 additions and 1 deletions
|
@ -39,7 +39,21 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
|||
var cond = Conductor.instance;
|
||||
|
||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||
transform.position = curve.GetPoint(flyPos);
|
||||
Vector3 lastPos = transform.position;
|
||||
Vector3 nextPos = curve.GetPoint(flyPos);
|
||||
|
||||
if (flyType)
|
||||
{
|
||||
Vector3 direction = (nextPos - lastPos).normalized;
|
||||
float rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * Time.deltaTime));
|
||||
}
|
||||
|
||||
transform.position = nextPos;
|
||||
|
||||
if (flyPos > 1f)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue