- Home /
Translate C# Into JavaScript Please?
Hello,
Could you please translate this into JavaScript for me?
using UnityEngine; using System.Collections;
public class CameraFacingBillboard : MonoBehaviour { public Camera m_Camera;
void Update()
{
transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.back,
m_Camera.transform.rotation * Vector3.up);
}
}
Thanks All!
Ollie
Answer by Justin Warner · Dec 13, 2010 at 03:03 PM
I'd guess:
var m_Camera Camera;
function Update()
{
transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.back, m_Camera.transform.rotation * Vector3.up);
}
Try that...
Answer by you.yi@live.fr · Jan 05, 2013 at 09:20 PM
Hello,
I have problems with this code (which is really hard I think) so could you translate this into javascript please?
const int NV = 27;
int i,k;
int cpt[8] = {-1,-1,-1,-1,-1,-1,3,3};
int vg[56][8];
std::vector edges;
int j = 0;
do {
for(i=0;i<8;++i) vg[j][i] = +cpt[i]; ++j;
for(i=0;i<8;++i) vg[j][i] = -cpt[i]; ++j;
}
while( std::next_permutation(cpt,cpt+8) );
int ren[56];
std::fill(ren,ren+56,-1);
int lren = 0;
for(i=0;i<56-1;++i)
for(j=i+1;j<56;++j)
{
int x = 0;
for(k=0;k<8;++k) x += vg[i][k]*vg[j][k];
if(x==8)
{
if(i==0)
{
ren[j]=lren++;
}
else if(ren[i]!=-1 && ren[j]!=-1)
edges.push_back( edge(ren[i],ren[j]) );
}
}
Thank you,
Angeline.