Skip to content

Cache reset poses so effectTargets maintain position #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ public ColliderButtonEventData.InputButton activeButton
}

private void Start()
{
CacheResetPoses();
}

// Updates the resetPoses with the current effectTarget poses
private void CacheResetPoses()
{
resetPoses = new RigidPose[effectTargets.Length];
for (int i = 0; i < effectTargets.Length; ++i)
{
resetPoses[i] = new RigidPose(effectTargets[i]);
}
}

#if UNITY_EDITOR
protected virtual void OnValidate()
{
Expand Down Expand Up @@ -77,6 +84,7 @@ public void OnColliderEventPressEnter(ColliderButtonEventData eventData)
{
if (eventData.button == m_activeButton && pressingEvents.Add(eventData) && pressingEvents.Count == 1)
{
CacheResetPoses();
buttonObject.localPosition += buttonDownDisplacement;
}
}
Expand Down