- Home /
How do I invert the Y axis in Penelope tutorial?
How do I invert the y axis on the rotationJoystick for the camera in the Player Relative Control scheme?
I'm assuming you have to implement in the playerrelativecontrol.js script that when the joystick is +1 to be -1 and vice versa but I've tried several lines and nothing so far. If someone could help me i'd greatly appreciate it. It would save me $30 from buying the 3rd Person Camera Kit from unityprefabs.com.
Thanks.
Answer by AngryOldMan · Apr 02, 2011 at 12:21 AM
go to edit ~> project settings ~> input and go down to the input which your script is using (joystick y?) and there is an option called invert, if you check that it should get the effect you want.
I attempted this but no luck, tried every invert including both horizontal and vertical that were attached to "Joystick" in the input options. Any few lines of code by any chance that could do this?
can you post the code that you controls your movement at the moment otherwise I can't help at all.
Answer by xMako · Jun 18, 2012 at 09:12 AM
Probably too late to answer this question for you, but maybe it will help others like me who did a quick google search on the topic.
At the end of CameraRelativeControl.js
Change this:
// Rotate around the character horizontally in world, but use local space
// for vertical rotation
cameraPivot.Rotate( 0, camRotation.x, 0, Space.World );
cameraPivot.Rotate( camRotation.y, 0, 0 );
}
to this:
// Rotate around the character horizontally in world, but use local space
// for vertical rotation
cameraPivot.Rotate( 0, camRotation.x, 0, Space.World );
cameraPivot.Rotate( -camRotation.y, 0, 0 );
}
Voila.
Answer by Elvis · Apr 02, 2011 at 04:12 PM
if ( character.isGrounded ) { var camRotation = rotateJoystick.position; camRotation.x *= rotationSpeed.x; camRotation.y *= rotationSpeed.y; camRotation *= Time.deltaTime;
thisTransform.Rotate( 0, camRotation.x, 0, Space.World );
cameraPivot.Rotate( camRotation.y, 0, 0 );
}
This is the code that applies the camera rotation to the rotateJoystick which is my right joystick on screen. It's located in my Update Function in PlayerRelativeControl.js. The thisTransform.Rotate line rotates the character around world-y using the x axis of the Joystick.
I was thinking you could just add a simple if statement like:
if ( rotateJoystick.position.x > 0 )
rotateJoystick.position.x = 1;
but it definitely didn't work and I'm sure it's more complex then that.
Your answer
Follow this Question
Related Questions
Unity iPhone and Unity Desktop Scripting Differences 2 Answers
Flipping textures 0 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer