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 ProjectCryken · Jan 18, 2014 at 01:17 PM · charactercontrollergravity

Make the character motor script gravity change directions?

So the default character motor script takes a float for the gravity and uses that to move the character down on the y-axis. How would I modify this to accept a Vector3 instead so I can move it in various directions(z,y,z) without breaking the script? The script does a lot of very helpful things and otherwise is perfect, so I don't want to have to rewrite it for this one addition and I don't fully understand its workings enough to write my own.

Comment
Add comment · Show 5
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 robertbu · Jan 18, 2014 at 07:11 PM 0
Share

I did a quick skim of the Character$$anonymous$$otor.js script. I saw no easy hack to make this change. There were a number of areas that assume a standard movement on the 'XZ' with gravity along the 'Y'.

avatar image ProjectCryken · Jan 18, 2014 at 08:41 PM 0
Share

That's unfortunate, also I have discovered you can't actually rotate the character controller collider, so I wouldn't be able to use a character controller anyway. What solutions are there to doing character movement; other than a rigidbody or character controller?

avatar image robertbu · Jan 18, 2014 at 08:50 PM 0
Share

I'm not an expert on character technology. You could directly move the transform and use Raycasting to detect collisions.

I don't know your game concept, but might it be possible to rotate the world (or at least the camera) and not the character? From the player's perspective it could look the same.

avatar image ProjectCryken · Jan 18, 2014 at 09:11 PM 0
Share

Hmmm... I found this. Which may do the trick, however I don't use c#, do you know what the js equivalent would be?

avatar image robertbu · Jan 18, 2014 at 10:08 PM 0
Share

Based on some comments made by someone with more $$anonymous$$arma than I had at the time, eight months ago I decided not to do any more Javascript <-> C# translations except for code I posted for an Answer. But I decided I would help anyone that made a good-faith effort at a translation finish their script. This is not a slap at you for asking, but I feel that Javascript <-> C# translation is a skill very helpful to interacting on this list, plus 90% of code can be translated knowing only a handful of differences between the two languages. Here is a reference that helped me when I started out with Unity:

http://answers.unity3d.com/questions/12911/what-are-the-syntax-differences-in-c-and-javascrip.html

I know that others active on the list don't have the stance with respect to translation, so If you post your request as a new question, you are likely to get an answer.

0 Replies

· Add your reply
  • Sort: 

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gravity without character controller 1 Answer

Character Controller Gravity 1 Answer

moving in the direction the camera is facing 1 Answer

Gravity and Jumping for a Character Controller 1 Answer

Character movement relative to both camera and transform 2 Answers


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