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 JackJones · Jul 01, 2010 at 07:50 PM · movementblendersideways

My character from blender moves side ways (How to rotate the model)

var speed = 3.0; var rotateSpeed = 3.0; var BullitPrefab:Transform; var jumpSpeed = 5.0;

function Update () {

    var controller : CharacterController = GetComponent(CharacterController);

    // Rotate around y = axis
    transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed * Time.deltaTime, 0);

    // Move forward / backward
    var forward = transform.TransformDirection(Vector3.forward);
    var curSpeed = speed * Input.GetAxis ("Vertical");
     if(Input.GetKey(KeyCode.S))
    {
    curSpeed *= 0.6;
    }
    controller.SimpleMove(forward * curSpeed);

 if (Input.GetButtonDown("Jump"))

{

     var bullit = Instantiate(BullitPrefab, 
     GameObject.Find("spawnpoint").transform.position, 
     Quaternion.identity);

 bullit.rigidbody.AddForce(transform.forward * 200);

var jumpSpeed = 5.0;

}

RequireComponent(CharacterController); }

here is my script for player movment for some reason my charcter moves sidways to the left when i press forward and to the right when i press down maybe i imported it wrong in to unity i dont know however how could i fix this

please help thanx ;)

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

2 Replies

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

Answer by spinaljack · Jul 01, 2010 at 07:54 PM

As you say, the model was created facing the wrong way. To fix this either make the model again facing the right way or put the model into an empty game object in unity and rotate the model so that it's facing the empty game object's forward direction (red arrow is right, blue arrow is forward)

Put the character movement script on the empty game object, not the model.

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 aaronsullivan · May 04, 2013 at 03:26 PM

facing the model the "right" way to work in Unity is the "wrong" way in blender so it is annoying. Here's a good fix though found here: http://forum.unity3d.com/threads/97119-Z-and-Y-Axis?p=842046&viewfull=1#post842046

"Steps to solve problem:

  1. Select object in Blender and rotate on X-axis by -90 degrees (don't panic! we'll fix it for Blender and Unity)

  2. From "Object" menu select "Apply > Rotation"

  3. According to Blender the object is no longer rotated. Rotate object by 90 degrees and presto!

Orientations are now correct in both Blender and Unity with rotation (0,0,0) in Unity and (90,0,0) in Blender!"

It works because rotating in "object" mode doesn't apply the rotation in the edit (like you accomplish with Apply > Rotation.)

Also be sure you do the same thing to your armature if you have one!

It would be nice if the automatic import in Unity would do this for you and hopefully that fix will come, but this is a way to do it without adding an extra gameobject for every object in game. It's also easily reversible (just Apply > Rotation again)

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

animation in blender to unity 0 Answers

How can I move player sideways by dragging with mouse or with mobile device when pressed down? 0 Answers

Making a bubble level (not a game but work tool) 1 Answer

character movement script 1 Answer

Moving character....northwest...? 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