- Home /
Please Help Convert js to c#
I have the following script and I am realy needing help geting it coverted over to c# most of my other scripts are c# and there not wanting to comunicate with js very well so I would like to switch this last script over to c#.
var explosion : GameObject;
var missile : GameObject;
function FixedUpdate () {
rigidbody.AddForce (transform.TransformDirection (Vector3.forward) * 200.0);
Destroy (missile, .5);
}
function OnCollisionEnter(collision : Collision) {
var contact : ContactPoint = collision.contacts[0];
var thisExplosion : GameObject = Instantiate (explosion, contact.point + (contact.normal * 5.0) , Quaternion.identity);
if (collision.gameObject.tag == "enemy")
{
Destroy (collision.gameObject);
}
if (collision.gameObject.tag == "metor")
{
Destroy (collision.gameObject);
//Quest1.Counter +=1;
}
if (collision.gameObject.tag == "mothership")
{
Destroy (collision.gameObject);
}
Destroy (thisExplosion, 2.0);
Destroy (gameObject);
}
Answer by Berenger · Nov 20, 2012 at 03:59 PM
As you wrote that question, I'm assuming you've got a cumputer, keyboard and fingers (I hope!). That's enough to convert JS -> C#.
But You could also try to put your script in the Standard Assets folder.
Hints : http://files.m2h.nl//js_to_c.php,
http://answers.unity3d.com/questions/327152/convert-javascript-to-c.html
http://answers.unity3d.com/questions/265197/need-help-converting-js-to-c.html
http://forum.unity3d.com/threads/46520-Online-UnityScript-Javascript-to-C-converter
And obviously : http://lmgtfy.com/?q=unity+convert+JS+to+C%23
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
problem sending information from js script to c# script 1 Answer
Lightning Script Js To C# Conversion errors 2 Answers
Convert JS to C# 1 Answer
Converting JS to C# 3 Answers