Created
June 20, 2024 08:04
-
-
Save yosun/da84b11f3fa42f72b702d33d7872e8e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using PolySpatial.Samples; | |
public class ModelProcessorPolyspatial : MonoBehaviour | |
{ | |
public Vector3 rotationAxis = new Vector3(0,42,0); | |
public bool rotating = true; | |
void Start() | |
{ | |
gameObject.AddComponent<PieceSelectionBehavior>(); | |
PieceSelectionBehavior psb = gameObject.GetComponent<PieceSelectionBehavior>(); | |
psb.moveable = true; | |
rotating = true; | |
//TODO stop rotating if moved | |
psb.PieceSelected += StopMoving; | |
} | |
void StopMoving(int n) | |
{ | |
rotating = false; | |
} | |
void Update() | |
{ | |
if (rotating) | |
{ | |
transform.localRotation *= Quaternion.Euler(rotationAxis * Time.deltaTime) ; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment