- Home /
How to set a limit for my player rotation ?
Hi Guys ! I've created this script to make "jump" and a little rotation for my player i want to stop my"CreamUP" rotation wen i reach -90 on X axis and i want to stop my "Update" rotation wen i reach 90 on x axis
There is a way for this ? I try with the If statement but the rotation in game seems different from the scene rotation so when i put "if (gameobject.Transform.eulerAngles.x
  using UnityEngine;
  using System.Collections;
 public class Player_Controller : MonoBehaviour 
 {
 private Rigidbody creamBody;
 public Animation creamJump;
 // Use this for initialization
 void Start () 
 {
     creamBody = gameObject.GetComponent<Rigidbody> ();
     creamJump.Play ("Take 001");
 }
 
 // Update is called once per frame
 void Update () 
 {
     creamBody.AddForce (0, -30, 0);
     gameObject.transform.Rotate (new Vector3 (1.35f, 0, 0));
 }
 public void CreamUP()
 {
     creamBody.velocity = new Vector3 (0, 17, 0);
     gameObject.transform.Rotate (new Vector3 (-40, 0, 0));
 }
 
}
Your answer
 
 
             Follow this Question
Related Questions
Help making orbiting planets,How to rotate around the objects with the largest mass? 0 Answers
Use MoveRotation to Look At Another Object 0 Answers
How to make an object(cylinder) always at the center of an object(Terrain)? 0 Answers
How not to make a RigidBody not go into ground when tilted foward? 1 Answer
how to shot a soccer ball in curve path according to the swipe type 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                