- Home /
I fix it
jump to the direction of the getaxis
EDIT
I have a jump animation which I want to jump at the direction I want with the WASD keys, By example if I press the W + Space key, the jump animation will play and also jumps forward with a force. If I press the S + Space key, it will play the same animation but the character jumps backwards.
Someone who can help me? I'm using JS.
Thanks in advance
Sorry not clear enough for me :) maybe you can provide some drawings?
what's the problem? use if-statements .. if(Input.Get$$anonymous$$ey("S") && Input.Get$$anonymous$$ey("SPACE")){ // play Animation // for example: rigidBody.AddForce(-1,2,0); } The syntax is not right, but you should know what I mean
I want to use the getaxis ("horizontal") and ("vertical").
Answer by fahimalavi · May 17, 2015 at 03:10 PM
1) Play animations 2) Use following code Vector3 movement; movement.Set (lh, 0, lv); //0 due to no flying zone ;) movement=movement.normalized *6*Time.deltaTime; // 6 is speed PlayerRigidBody.MovePosition(transform.position+movement);
Thanks for your answer, but I figured it out with a better and a simple solution :)