Hi Guys,
Iam new to scripting in c# i just want to know how to pass float values in Vector3 function.
right now following is my code.
[
void Move(){
if(Input.GetKey(“w”))
{
this.transform.Translate(new Vector3(0,1,0));
if(Input.GetKey(“s”))
{
this.transform.Translate(new Vector3(0,-1,0));
}
if(Input.GetKey(“a”))
{
this.transform.Translate(new Vector3(-1,0,0));
}
if(Input.GetKey(“d”))
{
this.transform.Translate(new Vector3(1,0,0));
}
}
]
thanks
Hi im actually entirely new to scripting guys
1 Like
i’m not sure if i entirely understood you question. were you asking how to use float as values for the parameters in Vector3? If that is what you were asking, you can try this.
float float1 = 1.0f;
float float2 = 3.0f;
float float3 = 5.0f;
Vector3 vect = new Vector3(float1, float2, float3);
yep thats wat i was asking about but latter i figured it out i only had to add a “f”
this.transform.Translate(new Vector3(0.0f,0.1f,0.0f));
like that
still thanks