• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 0 voto(i) - 0 media
  • 1
  • 2
  • 3
  • 4
  • 5
Crouch script
#2
Codice:
variabili :
private float charHeight;
private float h;
private Vector3 pos;
public CharacterController charCont;
public float speedToCrouch = 18;


funzione :
if(Input.GetKey(KeyCode.C)) h = 1;
else h = 2;

float lastHeight = charCont.height;
charCont.height = Mathf.Lerp(charCont.height, h, Time.deltaTime * speed);
pos.x = charCont.transform.position.x;
pos.z = charCont.transform.position.z;
pos.y = charCont.transform.position.y + (charCont.height - lastHeight) / 2;
charCont.transform.position = pos;
Dimmi se ti dà qualche problema Smile
 
  


Messaggi in questa discussione
Crouch script - da 93sunderland - 07-04-2016, 08:06 AM
RE: Crouch script - da Blackg96 - 08-04-2016, 08:14 PM
RE: Crouch script - da 93sunderland - 09-04-2016, 09:44 AM
RE: Crouch script - da Blackg96 - 09-04-2016, 12:13 PM
RE: Crouch script - da 93sunderland - 09-04-2016, 02:15 PM
RE: Crouch script - da Blackg96 - 10-04-2016, 09:48 AM
RE: Crouch script - da 93sunderland - 10-04-2016, 12:13 PM
RE: Crouch script - da Blackg96 - 10-04-2016, 02:03 PM
RE: Crouch script - da 93sunderland - 10-04-2016, 02:37 PM
RE: Crouch script - da Blackg96 - 11-04-2016, 07:30 PM

Vai al forum:


Browsing: 1 Ospite(i)