|
hi, i am making a game and have no idea what im doing wrong here, i am trying to make a script to crouch the character (fps), im using the physicswalker and have a spere with a colider on the grond that is "the feet" that is a child of the player so what i want to do is to have a button that makes the distance between the sphere and the player have a lower value, when i push the button, the position doesnt decrease, here is my script (the value is right if i dont have the if(Input.GetKey("r")) in the script, but then it stays like that all time obviously) function Start () { if(Input.GetKey("r")) { transform.localPosition = Vector3(0, -0.5, 0); } } what am i doing wrong?
(comments are locked)
|
|
You should do this in thank you very much, i still have a problem though, it worked to go down but when the char were about to rise again the collider teleported through the floor, i guess i would have to make it rise slow but have no idea how to do that, any ideas?
Apr 10 '12 at 06:37 PM
victorlarsson
(comments are locked)
|
|
I made this that will solve your problem, it scales your fps controller so that it looks like you're crouching..no problems with me so far..:)
(comments are locked)
|
|
I made this that will solve your problem, it scales your fps controller so that it looks like you're crouching..no problems with me so far..:)
(comments are locked)
|
|
I made this that will solve your problem, it scales your fps controller so that it looks like you're crouching..no problems with me so far..:) var tongle = 0; var localScale : Vector3; //var JumpSpeed = 100.0f; } P.S. sorry if i spammed that i wasn't sure if i did post it right @Skotous this is my script and I too am having the falling through the floor issue after releasing my crouch button "c" I am unable to use your script. I get all kinds of errors. I am using the CharacterMotor.js and FPSInputController.js also. function Update () { if (Input.GetKeyDown ("c")) { transform.position.y -= 0.5; } if (Input.GetKeyUp ("c")) { } }
Sep 03 '12 at 06:32 AM
BluEye
(comments are locked)
|
