This is awesome. Unfortunately the code isn't in the description. I am curious about the movement you created.
@LinhNguyen-yn2ef3 жыл бұрын
public class SoftCube : MonoBehaviour { protected MeshFilter MeshFilter; protected Mesh Mesh; public float UpDownFactor = 0.1f; public float UpDownSpeed = 6f; public float LeftFactor = 0.3f; public float LeftSpeed = 3f; public float LeftOffset = 2.3f; public float StrectFactor = -0.1f; public float StrectSpeed = 6f; // Start is called before the first frame update void Start() { Mesh = new Mesh(); Mesh.name = "NewMesh"; Mesh.vertices = NewVertCube(); Mesh.triangles = NewTrisCube(); Mesh.RecalculateNormals(); Mesh.RecalculateBounds(); MeshFilter = gameObject.AddComponent(); MeshFilter.mesh = Mesh; } private Vector3[] NewVertCube(float up = 0f, float left = 0f, float stretch = 0f) { return new Vector3[] { //Bottom new Vector3(-1,0,1), new Vector3(1,0,1), new Vector3(1,0,-1), new Vector3(-1,0,-1), //Top new Vector3(-1 - stretch + left, 2 + up, 1 + stretch), new Vector3(1 + stretch + left, 2 + up, 1 + stretch), new Vector3(1 + stretch + left, 2 + up, -1 - stretch), new Vector3(-1 - stretch + left, 2 + up, -1 - stretch), }; } private int[] NewTrisCube() { return new int[] { //Bottom 2,1,0, 2,0,3, //Top 4,5,6, 4,6,7, //front 2,7,6, 2,3,7, //back 4,0,1, 4,1,5, //left 0,4,3, 3,4,7, //right 1,2,6, 1,6,5, }; } // Update is called once per frame void Update() { Mesh.vertices = NewVertCube(Mathf.Sin(Time.realtimeSinceStartup * UpDownSpeed) * UpDownFactor, Mathf.Sin(Time.realtimeSinceStartup * LeftSpeed + LeftOffset) * LeftFactor, Mathf.Sin(Time.realtimeSinceStartup * StrectSpeed) * StrectFactor ); } }
@CallofTheUnknown2 жыл бұрын
Thanks
@davidtourangeau4 ай бұрын
// Optional: Change color over time for extra aesthetics private void OnRenderObject() { var renderer = GetComponent(); float colorValue = Mathf.PingPong(Time.time * 0.5f, 1); renderer.material.color = new Color(colorValue, colorValue, 1.0f); // Change to a gradient color } }
@egoinstart8756 Жыл бұрын
Nice but you've created a cube with 24 vertices instead of 8. Faces can use the same vertices.
@BitGamey5 жыл бұрын
Great effect, if you were moving an actual jelly object around though, wouldn't it tip backwards when moving instead of forwards?
@saikopiratos5 жыл бұрын
A few days ago, when i played red dead redemption, i was really impressed by the running and walking animation and asked myself how you could do this - so i think ive found it :D
@arpitsrivstva Жыл бұрын
it;s actually like that Plant vs Zombies plants if you have played that as well. BTw your playlists are awesome!
@LukeClark2 жыл бұрын
For Those who want a default size unity Cube (1, 1, 1) private Vector3[] GenerateVerts(){ return new Vector3[]{ // Bottom of Cube new Vector3(-0.5f, 0, 0.5f), new Vector3(0.5f, 0, 0.5f), new Vector3(0.5f, 0, -0.5f), new Vector3(-0.5f, 0, -0.5f), // Top of Cube new Vector3(-0.5f, 1, 0.5f), new Vector3(0.5f, 1, 0.5f), new Vector3(0.5f, 1, -0.5f), new Vector3(-0.5f, 1, -0.5f), // Left Side of Cube new Vector3(-0.5f, 0, 0.5f), new Vector3(-0.5f, 0, -0.5f), new Vector3(-0.5f, 1, 0.5f), new Vector3(-0.5f, 1, -0.5f), // Right Side of Cube new Vector3(0.5f, 0, 0.5f), new Vector3(0.5f, 0, -0.5f), new Vector3(0.5f, 1, 0.5f), new Vector3(0.5f, 1, -0.5f), // Front of Cube new Vector3(0.5f, 0, -0.5f), new Vector3(-0.5f, 0, -0.5f), new Vector3(0.5f, 1, -0.5f), new Vector3(-0.5f, 1, -0.5f), // Back of Cube new Vector3(-0.5f, 0, 0.5f), new Vector3(0.5f, 0, 0.5f), new Vector3(-0.5f, 1, 0.5f), new Vector3(0.5f, 1, 0.5f) }; } private int[] GenerateTriangles(){ return new int[]{ // Bottom 1, 0, 2, 2, 0, 3, // Top 4, 5, 6, 4, 6, 7, // left 9, 10, 11, 8, 10, 9, // right 12, 13, 15, 14, 12, 15, // front 16, 17, 19, 18, 16, 19, // back 20, 21, 23, 22, 20, 23 }; }
@MultsElMesco Жыл бұрын
And I was wondering why my meshes had such a weird lightning effect. Thank you!
@SuperTG0056 жыл бұрын
Can the next video be about putting a prefab/model into a fps so it moves his legs, arms and head with the movements of the FPS character
@GeoGames_Dev6 жыл бұрын
SuperTG005 interesting yes :)
@Wojbest_YT9 ай бұрын
Is it just me or this music sounds straight out of a goofy roblox tycoon