Hi i need help with some js code example i dont know how to use transform.localEulerAngles in C# properly.Basicly its a script for a character that turns the character to certain angles without turning the camera too.
What i dont understand or find any examples how to declare var body : transform in C# to be usable like in JS.
If instead i use:
transform.localEulerAngles.y = 90;
It says cannot modify value because its not a variable.Ive tried several examples i found with Vector3 and eulerAngles but they all turn the camera around too.
Im beginner learning C# and unity,so i have rewrote in C# what i found in this nice little tutorial - YouTube
var body : Transform;
function LateUpdate ()
{
if(Input.GetAxis("Vertical") == 0)
{
if(Input.GetAxis("Horizontal") > 0)
{
body.localEulerAngles.y = 90;
}
else if(Input.GetAxis("Horizontal") < 0)
{
body.localEulerAngles.y = -90;
}
}
…
Thanks for any help.
Edit: essentially what he rotates in the video is the biped of the character by writing var body:transform;(29:30 in video tut) then he can drag the biped in the new slot (transform).
I need how to i do that in C# if i write var body = Transform; i get erors obviously.
Sory i wasnt being explicit what i need.