using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JellyMesh : MonoBehaviour
{
public float Intensity = 1f;
public float Mass = 1f;
public float stiffness = 1f;
public float damping = 0.75f;
//you cannot have two types on the same declaration unless you give them a default value like so
private Mesh OriginalMesh = null, MeshClone = null;
private MeshRenderer renderer;
private JellyVertex[] jv;
private Vector3[] vertexArray;
void Start()
{
OriginalMesh = GetComponent<MeshFilter>().sharedMesh;
MeshClone = Instantiate(OriginalMesh);
GetComponent<MeshFilter>().sharedMesh = MeshClone;
renderer = GetComponent<MeshRenderer>();
jv = new JellyVertex[MeshClone.vertices.Length];
for (int i = 0; i < MeshClone.vertices.Length; i++)
//here you called jv, and jv is an array, so jv[i], MeshClone.vertices is also an array, so MeshClone.vertices[i]
jv[i] = new JellyVertex(i, transform.TransformPoint(MeshClone.vertices[i]));
}
void FixedUpdate()
{
vertexArray = OriginalMesh.vertices;
for (int i = 0; i < jv.Length; i++)
{
//here you called jv, and jv is an array, so jv[i]
Vector3 target = transform.TransformPoint(vertexArray[jv[i].ID]);
float intensity = (1 - (renderer.bounds.max.y - target.y) / renderer.bounds.size.y) * Intensity;
//here you called jv, and jv is an array, so jv[i]
jv[i].Shake(target, Mass, stiffness, damping);
//here you called jv, and jv is an array, so jv[i]
target = transform.InverseTransformPoint(jv[i].Position);
//here you called jv, and jv is an array, so jv[i]
vertexArray[jv[i].ID] = Vector3.Lerp(vertexArray[jv[i].ID], target, intensity);
}
MeshClone.vertices = vertexArray;
}
public class JellyVertex
{
public int ID;
public Vector3 Position;
public Vector3 velocity, Force;
public JellyVertex(int _id, Vector3 _pos)
{
ID = _id;
Position = _pos;
}
public void Shake(Vector3 target, float m, float s, float d)
{
Force = (target - Position) * s;
velocity = (velocity + Force / m) * d;
Position += velocity;
if ((velocity + Force + Force / m).magnitude < 0.001f)
Position = target;
}
}
}
I really have no idea what you’re talking about but I’ll give you +1 credit for at least getting the code formatting right.
Now, if you want some actual meaningful feedback from people who cannot read your mind, here is how to report your problem productively in the Unity3D forums:
Pay particular attention to Step 5 above. That’s the critical one.
How to understand compiler and other errors and even fix them yourself: