• 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.

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

why is my cube moving sideways in inconsistent distances? 2 Answers

Sword Mesh renderer script 1 Answer

problem with character motion and movement 1 Answer

what should I take note when making a game character? 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

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