Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 user-9115 (google) · Mar 31, 2011 at 03:08 AM · rotationcontroller

Rotating a character with the joystick of the controller

I am currently working on a script to allow my character to move using the joystick on a xbox 360 controller. The character is moving along a plain and has the ability to move in any direction. I am trying to get my character to rotate the way that he is moving based on the orientation of the joystick. Is this possible?

Here is the code I am using to get it to move.

function Update () {

moveForward = Input.GetAxis("Vertical") forwardBack; moveRight = Input.GetAxis("Horizontal") leftRight;

moveForward = -Time.deltaTime; moveRight = Time.deltaTime;

character.transform.position.x += moveForward; character.transform.position.z += moveRight; }

Comment
Add comment · Show 1
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 user-9115 (google) · Mar 31, 2011 at 03:25 AM 0
Share

The game is build for PC just using the xbox 360 controller. Not Developing for the xbox

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by AngryOldMan · Mar 31, 2011 at 03:16 AM

you need a third party plug in or the xbox dev tools from unity to get access to coding for xbox 360 (legally that is)

other solution is to get some 3rd party software that lets you map an xbox controller to actual keystrokes then mapping your controller to the specific keys your are using in your unity project. In order to get your xbox controller working with your computer you need a wired controller or a wireless adapter port for 360 to pc. the Wireless adapter port will let u sync 4 controllers.

And for future reference there is a button in your questions tool bar with a picture of binary code saying

101
010

highlight all your code and use that to format it so it can be seen in a lovely code box such as this

function NeatCodePlease()
{
   Debug.Log ("format your question code properly")
}
Comment
Add comment · Show 6 · 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 user-9115 (google) · Mar 31, 2011 at 03:37 AM 0
Share

This answer is irrelevant to the question asked. I have stated that the code works with a controller to move. I just want to know if it is possible to rotate the character based on the tilt axis of the controller.

avatar image AngryOldMan · Mar 31, 2011 at 04:22 AM 0
Share

1st of all you havn't asked anything about tilt control in your original post, sceondly unless you have some state of the art 360 controller it doesn't have tilt sensors. "I am trying to get my character to rotate the way that he is moving based on the orientation of the joystick." is very vague. you don't need to use a joystick coordinate at all you could just get your character to face your move direction nothing to do with your controller. So the answer wasn't irrelevant because you edited your question after I posted my answer, the fact is your question is too vague.still!

avatar image user-9115 (google) · Mar 31, 2011 at 04:29 AM 0
Share

The edit was for the code thank you for noticing my question didn't change at all. Awesome now we are getting somewhere. See it seems the question was not too vague since you were able to answer it. So if you could explain the relevance of the original post again that would be great. If I already have it working then it that doesn't mean I need to be told what I need to get it to work. A simple explanation of how to do what I was trying to do would have sufficed.

avatar image AngryOldMan · Mar 31, 2011 at 01:37 PM 0
Share

you don't need to use a joystick coordinate at all you could just get your character to face your move direction nothing to do with your controller. what don't you understand about that?

avatar image user-9115 (google) · Mar 31, 2011 at 11:02 PM 0
Share

That one sentence was all you needed to answer the question. Thanks

Show more comments

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.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Controlling an asteroid using a rigidbody. 1 Answer

how to rotate character controller? 0 Answers

Cube Gravity - Apply Gravity to a Curve 0 Answers

Face Direction Movement using CharacterController 1 Answer

AnimationController Resets Rotation After TimeLine Animation 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges