- Home /
Convert simple Java script to c#!
Can some one convert this Java Script to C# script:
var pointB : Vector3;
function Start () {
var pointA = transform.position;
while (true) {
yield MoveObject(transform, pointA, pointB, 3.0);
yield MoveObject(transform, pointB, pointA, 3.0);
}
}
function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float) {
var i = 0.0;
var rate = 1.0/time;
while (i < 1.0) {
i += Time.deltaTime * rate;
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
yield;
}
}
Answer by Julien-Lynge · Jul 17, 2012 at 07:24 PM
Yep! And that person is you!
Take a look at these resources to help you get started.
http://fragileearthstudios.com/2011/10/18/unity-converting-between-c-and-javascript-2/
There are a number of tutorials outlining the difference between C# and JS and how to convert between the two - check here, the forums, and on Google.
Answer by NhommeBeurreOne · Jul 17, 2012 at 07:57 PM
Not Perfect, but with the help of basic C# knowledge it will be. Convert JavaScript To C#. You may take a look at this Extension for more advanced conversion or start to think of learning C#.
NbO
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
How to use "GetComponent" and "transform" code in dll file? 0 Answers
How to restrict rotation 2 Answers
Smooth AutoMove Script? 0 Answers