|
So ive been wanting to make a "head bob" script for my fps character. I found one example of one on a website. It was in javaScript so i converted it to C# the best i could(im making the game for the flash platform so i dont want to deal with javaScript). I put it on my fps player's camera. However it has NO EFFECT on the camera. Can anyone tell me why this is? Here is my script: Any help is appreciated.
(comments are locked)
|
|
Hi! IpY is no pointer to the transform y or something. The calculated value is never written back to the actual transform. The last lines in Update must be something like: or a bit more compressed But that may not lead to a result also, because the actual movement happens somewhere else. You may need to change the Controller script directly and apply it in the calculation there, otherwise you never know which script is calculated first. Good luck yes, thanks for the reply it did actually cause a result... my camera on the fps controller shot directly upward. Heres what i put down: if(waveslice != 0) { float translateChange = waveslice * bobbingAmount; float totalAxes = Mathf.Abs(horizontal) + Mathf.Abs(vertical); totalAxes = Mathf.Clamp (totalAxes, 0.0f, 1.0f); translateChange = totalAxes * translateChange; Vector3 newPos = transform.localPosition; newPos.y += lpy; transform.localPosition = newPos; } else { lpy = midpoint; }
Apr 15 '12 at 07:17 PM
DGArtistsInc
(comments are locked)
|
