Strange issue following on from my last post about a null error on particle attachments that only occurred in standalone builds, but not the editor.
My ropes are frozen in place and the dynamic pin constraint appears to have no affect only in the standalone build.
In this screenshot the ropes ends are supposed to be connected to the pallet with dynamic pin constraints.
My code:
There are no errors or warnings in the output log file.
My ropes are frozen in place and the dynamic pin constraint appears to have no affect only in the standalone build.
In this screenshot the ropes ends are supposed to be connected to the pallet with dynamic pin constraints.
My code:
Code:
// m_Ropes is an array of 4 ObiRopes
for (int i = 0; i < m_Ropes.Length; i++)
{
// Create a new blueprint
var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();
blueprint.path.Clear();
blueprint.path.AddControlPoint(m_Ropes[i].transform.InverseTransformPoint(m_HelicopterAnchorPoints[i].position), m_HelicopterAnchorPoints[i].up, -m_HelicopterAnchorPoints[i].up, m_HelicopterAnchorPoints[i].up, 0.1f, 0.1f, 1, 1, Color.white, "Start");
blueprint.path.AddControlPoint(m_Ropes[i].transform.InverseTransformPoint(anchorPoints[i].position), anchorPoints[i].up, -anchorPoints[i].up, anchorPoints[i].up, 0.1f, 0.1f, 1, 1, Color.white, "End");
blueprint.path.FlushEvents();
blueprint.GenerateImmediate();
// Set the same phase as the colliders
for (int x = 0; x < Mathf.Min(blueprint.phases.Length, m_EndParticleCollisionFilterCount); x++)
{
blueprint.phases[x] = m_EndParticlePhase;
}
for (int x = blueprint.phases.Length - 1; x > Mathf.Max(blueprint.phases.Length - 1 - m_EndParticleCollisionFilterCount, 0); x--)
{
blueprint.phases[x] = m_EndParticlePhase;
}
m_Ropes[i].ropeBlueprint = blueprint;
maxLength = m_Ropes[i].restLength;
// Get components
mainAttachments[i] = m_Ropes[i].gameObject.AddComponent<ObiParticleAttachment>();
palletAttachments[i] = m_Ropes[i].gameObject.AddComponent<ObiParticleAttachment>();
// Find the particle groups
var groups = m_Ropes[i].blueprint.groups;
mainAttachments[i].Awake();
palletAttachments[i].Awake();
// Attach sub rope to main rope
mainAttachments[i].target = m_ObiCollider.transform;
mainAttachments[i].particleGroup = groups[0];
mainAttachments[i].attachmentType = ObiParticleAttachment.AttachmentType.Static;
// Attach the rope to the pallet
palletAttachments[i].target = m_Pallet;
palletAttachments[i].particleGroup = groups[groups.Count - 1];
palletAttachments[i].attachmentType = ObiParticleAttachment.AttachmentType.Dynamic;
m_Ropes[i].gameObject.SetActive(true);
}
There are no errors or warnings in the output log file.