Skip to content

Instantly share code, notes, and snippets.

@yosun
Created June 20, 2024 08:04
Show Gist options
  • Save yosun/da84b11f3fa42f72b702d33d7872e8e5 to your computer and use it in GitHub Desktop.
Save yosun/da84b11f3fa42f72b702d33d7872e8e5 to your computer and use it in GitHub Desktop.
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