Dev Log – Another Unity Prototype – this time the pulsing Saturn like sphere with one donut ring

This Prototype contains a pulsing Ring around the sphere. Diamonds Material and Rotation look nice but not perfect. (Single Spotlight did not help, rotation of the Objects did also not help)
The Donut Ring is to “fat”. (I stretched it already)

I did the ring with Paint3D. I guess it’s time for some Blender.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PulseDonut : MonoBehaviour {
    //[SerializeField]
    [Range(-10.0f, 20.0f)]
    public float pulseFactor = 1f;

    public int test;
    public Vector3 originalScale;

    public float newRotation = 0;

    public bool autoPulse = false;

    public float minPulse = -10f;
    public float maxPulse = 20f;
    public float curPulse = 0f;
    public float incPulse = 0.1f;
    public bool expandPulse = true;

    // Use this for initialization
    void Awake () {
        originalScale = this.transform.localScale;
    }
	
	// Update is called once per frame
	void Update () {
        /*
        newRotation = newRotation + pulseFactor;
        if (newRotation >= 180) { newRotation = -180;}
        this.transform.rotation = new Quaternion(this.transform.rotation.x, newRotation, this.transform.rotation.z, this.transform.rotation.w);
        */
        if (autoPulse == true)
        {
            //Breitet sich unendlich aus...
            //this.transform.localScale += new Vector3(pulseFactor,0,pulseFactor);
            //this.transform.localScale = (originalScale.localScale + new Vector3(pulseFactor, 0, pulseFactor));
            

            if (expandPulse==true)
            {
                curPulse = curPulse + incPulse;
            }
            else
            {
                curPulse = curPulse - incPulse;
            }
            if(curPulse <= minPulse) { expandPulse = true; }
            if (curPulse >= maxPulse) { expandPulse = false; }

            this.transform.localScale = (originalScale + new Vector3(curPulse, 0, curPulse));
            /*
            public float minPulse = -10f;
            public float maxPulse = 20f;
            public float incPulse = 0.001f;
            public bool expandPulse = true;
            */
        }
        else
        {
            //Breitet sich unendlich aus...
            //this.transform.localScale += new Vector3(pulseFactor,0,pulseFactor);
            //this.transform.localScale = (originalScale.localScale + new Vector3(pulseFactor, 0, pulseFactor));
            this.transform.localScale = (originalScale + new Vector3(pulseFactor, 0, pulseFactor));
        }
    }
}

Tutorial:

See…
donut1_blender.fbx
donut2.fbx
donut3.fbx


Not is_singular( ) or Posttype mismatch bgp_ueassetpost1

Leave a Reply