This is v. similar to the previous flocking post, only now we use a skinned & animated mesh & it's attached Animator component. Something to note, one instance of the prefab has to be in the scene, or it doesn't work (move it off camera or something). Also - the material that uses the surface shader , must have the GPU instancing enabled! That's what those if-checks are for! The gist of this is - we need to store the vertex animation into another buffer. The compute shader doesn't deal with this data at all - it is only concerned with the position/direction of each instance. It is the surface/vert-frag shader that will deal with it. The only bit the compute shader does increment is the "frame" of animation, which is determined by the speed at which the boid is moving. C# SCRIPT using System.Collections; using System.Collections.Generic; using UnityEngine; public class SkinnedFlocking : MonoBehaviour { public struct Boid { ...
Many of you might be used to using the old Klak/MidiJack libraries for midi input into Unity, however they're getting a little long in the tooth now & Unity has changed up its input system to supposedly be more flexible & modern. The new midi input library is called Minis, I'm pretty sure it's short for Midi New Input System.. but that doesn't really matter :D There isn't a whole lot of easy-to-understand documentation on how to use it in scripts, so I thought I'd share what I'd figured out through digging around Keijiro's example files. I'm kind of assuming you know how to use the Input Action menu - as it would seem you don't even need it, for the method I'm about to show you... In any case if you do setup some midi inputs there (or indeed any other kinds of inputs - and it seems like you can only setup simple single note button presses there? - you would use code resembling this (following) to trigger things functions as you would ...
Comments
Post a Comment