- Home /
Make the first person controller transparent?
Hi everyone :) I have a script that makes the camera move up and down when you walk. However, when I test my game I see that if you look straight down you can see the first person controller. Is there any way to make it transparent? Thanks for any help!
Script I am using -
private var timer = 0.0;
var bobbingSpeed = 0.18;
var bobbingAmount = 0.2;
var midpoint = 2.0;
function Update () {
waveslice = 0.0;
horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxis("Vertical");
if (Mathf.Abs(horizontal) == 0 && Mathf.Abs(vertical) == 0) {
timer = 0.0;
}
else {
waveslice = Mathf.Sin(timer);
timer = timer + bobbingSpeed;
if (timer > Mathf.PI * 2) {
timer = timer - (Mathf.PI * 2);
}
}
if (waveslice != 0) {
translateChange = waveslice * bobbingAmount;
totalAxes = Mathf.Abs(horizontal) + Mathf.Abs(vertical);
totalAxes = Mathf.Clamp (totalAxes, 0.0, 1.0);
translateChange = totalAxes * translateChange;
transform.localPosition.y = midpoint + translateChange;
}
else {
transform.localPosition.y = midpoint;
}
}
The problem -
Answer by Jeejo · May 25, 2013 at 02:10 AM
Remove the Mesh Renderer, or you can make a transparent texture and assign it to the player.
@AxillarHD - if you question is answered, click the checkmark next to the answer to close it out. Thanks.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
expecting (, found 'OnConnectedToServer'. 0 Answers
Why is my update function acting wierd? 1 Answer
NullReferenceExeption: Object reference not set to an instance of an object. 1 Answer
question with gui 2 Answers