I’m getting regular spikes with garbage collection and it’s pointing to a script that draws a vectrosity line from the tip of a fishing rod model that is being bent using polymorpher.
Can anyone see anything that really stands out in my script that could be causing it? I honestly don’t have a clue. ![]()
Here’s the code, it’s finding the vertex at the rod tip and drawing a line from it to another object.
using UnityEngine;
using System.Collections;
using Vectrosity;
public class polyMorpherSnapVertexVectrosity : MonoBehaviour {
public PolyMorpher m_morpher;
public int m_vertexID = 68;//this id match with rod model
bool updateline = false;
public VectorLine myLine;
public Vector3 startPoint;
public GameObject lineEnd;
public Color colour;
void LateUpdate () {
if (updateline == true lineEnd!=null){
m_vertexID = Mathf.Clamp( m_vertexID, 0, m_morpher.m_mesh.vertexCount );
transform.position = m_morpher.transform.TransformPoint( m_morpher.m_mesh.vertices[m_vertexID] );
myLine.points3[0] = transform.position; myLine.points3[1] = lineEnd.transform.position; myLine.Draw3D();
}
else{
}
}
public void drawline (){
myLine = VectorLine.SetLine3D (colour, transform.position, lineEnd.transform.position);
updateline = true;
}
public void destroyline (){
VectorLine.Destroy (ref myLine);
updateline = false;
}
}
Thanks
