• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Elvis · Apr 01, 2011 at 11:14 PM · javascriptinputiphone

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
3

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Elvis · Apr 02, 2011 at 09:39 AM 0
Share

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?

avatar image AngryOldMan · Apr 02, 2011 at 11:55 AM 0
Share

can you post the code that you controls your movement at the moment otherwise I can't help at all.

avatar image
1

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

Unity iPhone and Unity Desktop Scripting Differences 2 Answers

Flipping textures 0 Answers

What's the difference between gameObject and GameObject? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges