- Home /
How can i rotate player when player jump ?
Hi Im trying when capsule player jump rotating. but it couldnt work.. when player jump gravity direction is also rotating and looks funny.. i wanna player rotate 360 degree when jump. and gravity must be same direction positive y direction.
here is my code.
     void FixedUpdate () {
         System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
         //time = sw.ElapsedMilliseconds;
         //timetext.text = time.ToString();
         //transform.position = new Vector3(transform.position.x, transform.position.y, 0.3f);
 
         PlayerMove();
         PlayerJump();
         
 
 
         
 
 
     }
 
     
     void PlayerJump()
     {
         if (Input.GetKey(KeyCode.Space) && isGround)
         {
 
             rd.AddForce(Vector3.up * jumpPower);
             isJump = true;
 
         }
 
         if (!isGround)
         {
             Quaternion deltarotation = Quaternion.Euler(player_velocity * Time.deltaTime);
             rd.MoveRotation(rd.rotation * deltarotation);
             isJump = false;
         }
 
         
 
     }
 
     void PlayerMove()
     {
         float moveFoward = Input.GetAxis("Horizontal") * Time.deltaTime;
         moveFoward *= speed;
         transform.Translate(new Vector3(moveFoward, 0, 0));
         
     }
 
thanks
[1]: /storage/temp/130166-honeycam-2018-12-29-05-27-182.gif
 
                 
                honeycam-2018-12-29-05-27-182.gif 
                (18.2 kB) 
               
 
              
               Comment
              
 
               
              sorry i add gif image. right now this is my condition.
Your answer
 
 
             Follow this Question
Related Questions
Rigidbody unwanted drifting 3 Answers
How can I rotate and move a cylindrical rod from one side with respect to other side? 1 Answer
Apply Gravity to Car Physics 0 Answers
Artificial Gravity 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                