- Home /
Question by
HighMrsai · Jan 21, 2015 at 02:14 PM ·
transformrotaterotatearoundpivot-point
Rotate Around an Object using a different pivot point?
Im making a game similar to super monkey ball.
The main character(A sphere) is moved by tilting the entire level.
Here is my code :
if(joyPos.x > 0){ //rotate world to the right
level.transform.RotateAround (character.transform.position, Vector3.fwd, rotateSpeed * Time.deltaTime);
}
if(joyPos.x < 0){
level.transform.RotateAround (character.transform.position, Vector3.back, rotateSpeed * Time.deltaTime);
}
if(joyPos.y > 0){
level.transform.RotateAround (character.transform.position, Vector3.right, rotateSpeed * Time.deltaTime);
}
if(joyPos.y < 0){
level.transform.RotateAround (character.transform.position, Vector3.left, rotateSpeed * Time.deltaTime);
}
This almost does what i want it to do the problem is that when i use transform.RotateAround the level is being rotated around the player sphere relative to its own pivot point. I want it to rotate around the player and use the players poisition as its pivot point. Is this possible? lmk if you want me to elaborate more
Comment
Your answer
Follow this Question
Related Questions
transform RotateAround 1 Answer
rotation script in unity 3 Answers
transform.rotate only 1 time for 180 degrees? 1 Answer
how to rotate game-Object in a fixed position 1 Answer
Rotate Around Object 2 Answers