# Mesh facing the wrong way!

## Recommended Posts

So i imported my mesh into unity and when it moves it acts like its right side is his front and start walking sideways!

i tried re importing it and i tried making the mesh again but facing it a different way but it doesnt change in the game please help ive been trying to fix it for ages!

##### Share on other sites

Unity sucks this way. It has to do with Unity's coordinate, then there is also the fact that it can't import normals correctly, it's scale has problems, it imports smooth groups wrong... In short: there isn't any format, mesh type or 3D software than Unity imports correctly.

So here is what you do: You import your 3D software file, if you use Blender that means importing the .Blend. Remember to delete everything in the scene you don't want to import.

Once you have imported this file you will find it is attached to a container, a empty 3D object. Apply movement to this object instead of the character. The character is attached to this object and will act with it, this object has the correct rotation for Unity.

No matter if you use Blender, Maya or Max; Unity will import the mesh as a .FBX, so there is no downside to doing things this way; in performance. Although if you give someone the editor files they also need the same 3D software.

Check that Unity calculates the normals and tangents, instead of importing them. Don't bother with smooth groups, they increase the vertex count, limiting the batching Unity can do with a object.

Always build your material in engine, no matter what engine you use.

Importing the 3D software file is only a short term solution, you will need to make the proper adjustments at some point. To do this make a axis in your 3D software and align it with Unity. If you want I can explain more about this.

Edited by Scouting Ninja

##### Share on other sites
24 minutes ago, Scouting Ninja said:

Unity sucks this way. It has to do with Unity's coordinate, then there is also the fact that it can't import normals correctly, it's scale has problems, it imports smooth groups wrong... In short: there isn't any format, mesh type or 3D software than Unity imports correctly.

So here is what you do: You import your 3D software file, if you use Blender that means importing the .Blend. Remember to delete everything in the scene you don't want to import.

Once you have imported this file you will find it is attached to a container, a empty 3D object. Apply movement to this object instead of the character. The character is attached to this object and will act with it, this object has the correct rotation for Unity.

No matter if you use Blender, Maya or Max; Unity will import the mesh as a .FBX, so there is no downside to doing things this way; in performance. Although if you give someone the editor files they also need the same 3D software.

Check that Unity calculates the normals and tangents, instead of importing them. Don't bother with smooth groups, they increase the vertex count, limiting the batching Unity can do with a object.

Always build your material in engine, no matter what engine you use.

Importing the 3D software file is only a short term solution, you will need to make the proper adjustments at some point. To do this make a axis in your 3D software and align it with Unity. If you want I can explain more about this.

I imported the file but there was no empty 3D object? i added one but it just went off on its own without the mesh

##### Share on other sites

If you add one you need to drag the mesh into it using the Unity Hierarchy, window with the list of object names, check that both objects are at the 0,0,0 point when doing it.

Once you have them linked this way, drag the object out of the hierarchy into a assets folder to create a prefab for re-use. Check the Unity manual on importing and  the prefabs topics for more details.

If you used the 3D software save file, then the object you got is the container. Click on it's arrow in the hierarchy to view what is inside.

Edited by Scouting Ninja

##### Share on other sites
10 hours ago, Scouting Ninja said:

If you add one you need to drag the mesh into it using the Unity Hierarchy, window with the list of object names, check that both objects are at the 0,0,0 point when doing it.

Once you have them linked this way, drag the object out of the hierarchy into a assets folder to create a prefab for re-use. Check the Unity manual on importing and  the prefabs topics for more details.

If you used the 3D software save file, then the object you got is the container. Click on it's arrow in the hierarchy to view what is inside.

I just tried this it doesnt seem to work i will try and send a video

I attached a video below

also what i show in the video isnt the original problem before the monster was upright and just faced his right side towards me

Edited by KnowItAllGames

##### Share on other sites

Can you upload a screen of the monster, also we need to see the script to see if the problem isn't there.

This image will show what I am looking for:

Edited by Scouting Ninja
Format.

##### Share on other sites

2 hours ago, Scouting Ninja said:

Can you upload a screen of the monster, also we need to see the script to see if the problem isn't there.

This image will show what I am looking for:

Reveal hidden contents

There is a screen shot and here are the scripts for he AI

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AIScript : MonoBehaviour {

public float fpsTargetDistance;
public float enemyLookDistance;
public float attackDistance;
public float enemyMovementSpeed;
public float damping;
public Transform fpsTarget;
Rigidbody theRigidbody;
Renderer myRender;

// Use this for initialization
void Start () {
myRender = GetComponent<Renderer> ();
theRigidbody = GetComponent<Rigidbody>();
}

// Update is called once per frame
void FixedUpdate () {
fpsTargetDistance = Vector3.Distance (fpsTarget.position, transform.position);
if (fpsTargetDistance < enemyLookDistance) {
myRender.material.color = Color.yellow;
lookAtPlayer ();
print ("Look at dah player");
}
if (fpsTargetDistance < attackDistance) {
myRender.material.color = Color.red;
print ("Attack");
} else {
myRender.material.color = Color.blue;
}
}

void lookAtPlayer(){
Quaternion rotation = Quaternion.LookRotation (fpsTarget.position - transform.position);
transform.rotation = Quaternion.Slerp (transform.rotation, rotation, Time.deltaTime * damping);
}

}
}

Edited by KnowItAllGames

##### Share on other sites

OK first your monster need to be rotated so that he is looking towards the blue arrow.

Then use the Unity look function instead of your "void look at player" function. That is "transform.LookAt(target)".

https://unity3d.com/learn/tutorials/topics/scripting/look this tutorial explains it.

Blue is forward, red is side ways and green is up.

##### Share on other sites
37 minutes ago, Scouting Ninja said:

OK first your monster need to be rotated so that he is looking towards the blue arrow.

Then use the Unity look function instead of your "void look at player" function. That is "transform.LookAt(target)".

https://unity3d.com/learn/tutorials/topics/scripting/look this tutorial explains it.

Blue is forward, red is side ways and green is up.

Ok but when i rotate the monster and do the script he just walks to his right facing forward? im sorry i think being stupid, i might have done the script wrong can you please edit it the way you explained?

Edited by KnowItAllGames

##### Share on other sites

This Unity pack has a simple setup for using the navmesh.

Note that waypoints don't need to be set this way, this is only to show how to find the player. https://docs.unity3d.com/Manual/nav-AgentPatrol.html

Import the pack by right clicking and selecting custom pack, don't import into your game this is only a reference; there is a lot that can be improved especially my hard coding.

NavMeshHelp.unitypackage

## Create an account

Register a new account

• 12
• 11
• 22
• 11
• 15
• ### Similar Content

• I am animator by hand, and i am doing game animation for at least 8 years so far. During the last 2 years, i came with a idea for game and maybe some day, i want to start indie game company. As i am thinking to start game company, i am also thinking what kind of value i can give to the company. For example, am experience in animation,sales(I was selling web development services, before i jumped to gaming), bit of rigging- just not for production, i am learning on the side as well. The rest of the gaming production, like modeling, concept art, texturing, i am total noob or to say better, i am no near interest to do modeling for example, don't have such a patience to do it. But before characters and things are made for animating, what the hell i am would do?
Also, what is the ideal size of the founding team of a game company? Positions to be filled mostly are, Concept artist, Modeler/Texture artist, programmer, animator-rigger. And later would need more people to join, like more animators, programmers, sound, fx,etc.

And lastly, do i need to have something,like a prototype, to show people and get them interest, or should i ask someone i know, for skill that i lack, for example, Modeling would be great, texturing and rigging, and to start all together from scratch?

• Hi , I was considering this start up http://adshir.com/, for investment and i would like a little bit of feedback on what the developers community think about the technology.
So far what they have is a demo that runs in real time on a Tablet at over 60FPS, it runs locally on the  integrated GPU of the i7 . They have a 20 000 triangles  dinosaur that looks impressive,  better than anything i saw on a mobile device, with reflections and shadows looking very close to what they would look in the real world. They achieved this thanks to a  new algorithm of a rendering technique called Path tracing/Ray tracing, that  is very demanding and so far it is done mostly for static images.
From what i checked around there is no real option for real time ray tracing (60 FPS on consumer devices). There was imagination technologies that were supposed to release a chip that supports real time ray tracing, but i did not found they had a product in the market or even if the technology is finished as their last demo  i found was with a PC.  The other one is OTOY with their brigade engine that is still not released and if i understand well is more a cloud solution than in hardware solution .
Would there  be a sizable  interest in the developers community in having such a product as a plug-in for existing game engines?  How important  is Ray tracing to the  future of high end real time graphics?

• Good day,

I just wanted to share our casual game that is available for android.

Description: Fight your way from the ravenous plant monster for survival through flips. The rules are simple, drag and release your phone screen. Improve your skills and show it to your friends with the games quirky ranks. Select an array of characters using the orb you acquire throughout the game.

Trailer:

• Hello fellow devs!
Once again I started working on an 2D adventure game and right now I'm doing the character-movement/animation. I'm not a big math guy and I was happy about my solution, but soon I realized that it's flawed.
My player has 5 walking-animations, mirrored for the left side: up, upright, right, downright, down. With the atan2 function I get the angle between player and destination. To get an index from 0 to 4, I divide PI by 5 and see how many times it goes into the player-destination angle.

In Pseudo-Code:
angle = atan2(destination.x - player.x, destination.y - player.y) //swapped y and x to get mirrored angle around the y axis
index = (int) (angle / (PI / 5));
PlayAnimation(index); //0 = up, 1 = up_right, 2 = right, 3 = down_right, 4 = down

Besides the fact that when angle is equal to PI it produces an index of 5, this works like a charm. Or at least I thought so at first. When I tested it, I realized that the up and down animation is playing more often than the others, which is pretty logical, since they have double the angle.

What I'm trying to achieve is something like this, but with equal angles, so that up and down has the same range as all other directions.

I can't get my head around it. Any suggestions? Is the whole approach doomed?

Thank you in advance for any input!

• Hi everyone!

I am from an indie studio that has received funding for our concept and is ready to create the next generation 2D Pokemon-inspired MMORPG called Phantasy World. This ad is for a volunteer position but hopefully will transition into something more. Our vision is to create a game that draws inspiration from the series but is dramatically different in both aesthetics and gameplay as the work would be our own.

We are hoping that you can help us make this a reality and are looking for game developers familiar with the unreal engine and would be happy to work on a 2D top down game. Sprite artists are also welcome as we are in desperate need of talented artists! Join our discord and let's have a chat! https://discord.gg/hfDxwDX

Here's some of our in game sprites for playable characters while moving around the game world! Hope to see you soon!