10-07-2017, 01:56 PM
(This post was last modified: 10-07-2017, 02:05 PM by PhantomBadger.)
Tangentially related to my previous thread (here), but ultimately a different issue, so I decided to make a new topic;
Is there a way to teleport the rope, essentially 'resetting' it at a new position during runtime?
I mentioned my current set up in the previous thread (this post), where the rope object is connected to two anchors, which are then connected to two external game objects. My current attempt teleport all these components, the anchors and game objects teleport fine, but the rope then flies towards them to catch up, causing high velocities and undesired effects.
Cheers!
EDIT:
Seems I was a bit quick to post here! The solution I found was calling the aptly named 'ResetActor()' method in ObiRope.
Should anyone else want it, my implemented solution is as follows;
I'm hoping there's no negative repercussions to using this method I'm unaware of?
Is there a way to teleport the rope, essentially 'resetting' it at a new position during runtime?
I mentioned my current set up in the previous thread (this post), where the rope object is connected to two anchors, which are then connected to two external game objects. My current attempt teleport all these components, the anchors and game objects teleport fine, but the rope then flies towards them to catch up, causing high velocities and undesired effects.
Cheers!
EDIT:
Seems I was a bit quick to post here! The solution I found was calling the aptly named 'ResetActor()' method in ObiRope.
Should anyone else want it, my implemented solution is as follows;
Code:
/// <summary>
/// Moves all components of the rope by a set amount
/// </summary>
/// <param name="distanceToMove">The distance to move the rope parts</param>
public void MoveRopeByAmount(Vector3 distanceToMove)
{
//Wire points are the anchor objects
//Target points are the connector gameobjects attached to the anchors
for (int i = 0; i < targetPoints.Length && i < wirePoints.Length; i++)
{
targetPoints[i].transform.position += distanceToMove;
wirePoints[i].transform.position += distanceToMove;
}
ObiRope.transform.position += distanceToMove;
ObiRope.ResetActor();
//Custom method to reset velocity of the rope & it's components
ResetVelocity();
}