Hi I want to convert my Js code to c # It was correct when he wrote in js but not correct in c # Please tell me the correct way
void Brake () {
W_RL.GetGroundHit (out hit);
var HH = Mathf.Abs (hit.sidewaysSlip);
if (stop)
{
W_FL.brakeTorque = 100;
W_FR.brakeTorque = 100;
}
else
{
W_FL.brakeTorque = 0;
W_FR.brakeTorque = 0;
}
if (C_Speed > 20 && stop && HH >0)
{
A_T.volume = 1;
P_T_L.particleEmitter.emit = true;
P_T_R.particleEmitter.emit = true;}
The problem is in line 2 How do I define HH? As a variable
Comment
Best Answer
Answer by Commoble · Mar 15, 2017 at 09:00 PM
float HH = Mathf.Abs(hit.sidewaysSlip);
Technically your way should be correct in C# too, but I personally really dislike using var.
Your answer
![](https://koobas.hobune.stream/wayback/20220612113243im_/https://answers.unity.com/themes/thub/images/avi.jpg)