I need to translate an object form A to B.
I found this unifycommunity.com
and it work fine but i need to convert it in C#.
If I understand the MoveObject.js can remain in js but I can’t convert the example to C#
The example is it:
function Start () {
// Starting from the origin, move this object to 5 units along X by 10 units along Z, at 2.5 units per second
yield MoveObject.use.Translation(transform, Vector3.zero, Vector3(5.0, 0.0, 10.0), 2.5, MoveType.Speed);
// When that's done, simultaneously move up one unit and flip 180 degrees along the Z axis, doing both in half a second
MoveObject.use.Translation(transform, Vector3.up, .5, MoveType.Time);
MoveObject.use.Rotation(transform, Vector3.forward * 180.0, .5);
}
I read in C# I must write StartCoroutine, but I can’t do it.
Can any help me? Thanks
IEnumerator Start ()
{
// Starting from the origin, move this object
// to 5 units along X by 10 units along Z, at 2.5 units per second
yield return StartCoroutine
(MoveObject.use.Translation
(transform, Vector3.zero, Vector3(5.0, 0.0, 10.0), 2.5, MoveType.Speed));
// When that's done, simultaneously move up one unit
// and flip 180 degrees along the Z axis, doing both in half a second
StartCoroutine(MoveObject.use.Translation(transform, Vector3.up, .5, MoveType.Time));
StartCoroutine(MoveObject.use.Rotation(transform, Vector3.forward * 180.0, .5));
}
StartCoroutine(method) — Creates a coroutine that runs side by side this one
`yield return ____________________________________________;
-
null //waits for one frame to pass and resumes during the Update calls
-
break //kills this coroutine immediately.
-
StartCoroutine(nameOfCoroutine()) //waits for nameOfCoroutine to finish
-
new WaitForSeconds(X) //waits for X seconds
-
new WaitForFixedUpdate() // waits for one frame to pass and resumes during the FixedUpdate calls`