KnowItAllGames

Mesh facing the wrong way!

10 posts in this topic

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!

 

0

Share this post


Link to post
Share on other sites

Posted (edited)

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
3

Share this post


Link to post
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

0

Share this post


Link to post
Share on other sites

Posted (edited)

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
2

Share this post


Link to post
Share on other sites

Posted (edited)

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 

2017-06-20_09-50-31.mp4

Edited by KnowItAllGames
0

Share this post


Link to post
Share on other sites

Posted (edited)

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:

 

YIm8Y0p.png

Edited by Scouting Ninja
Format.
1

Share this post


Link to post
Share on other sites

Posted (edited)

 

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

YIm8Y0p.png

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;
			attackPlease ();
			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);
    }

	void attackPlease(){
		theRigidbody.AddForce (transform.forward * enemyMovementSpeed);

	}
}

 

 

Screenshot.png

Edited by KnowItAllGames
0

Share this post


Link to post
Share on other sites

Posted (edited)

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
0

Share this post


Link to post
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

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • By Altri
      Hello, a friend of mine and I for over a year and a half now have been working on a mobile moba. We have the server runtime ready and most of the mechanics of the game down. At the moment it's 3v3 which is why we need a C# Unity developer to help out finish out some missing features along with 5v5 mode. Thought the game looks like it's almost done, all the assets are taken from the old league of legends map or WoW. We also only have around 10 heroes and would love some artists to help out build out more with us. Currently the team is only made up of 2 programmers so development has gone a little slow.
      That is our goal. This is and has been a hobby for a while but our ultimate goal is to release the game to the market and do great. This would be a great opportunity and we're looking for people with passion for games.
      You may contact me on Discord at Altri#7510 or by email, veraalex97@gmail.com
      If you're an artist you could send me artwork too, doesn't matter if you're amazing or not we need all kinds of help.
      Thank you for your time,
      Altri
       
      *note*
      revenue share will be possible once the game is out, i wanna start a team
       
      [SCREENSHOTS]
    • By EMB
      Hi all,
      EDIT: Thanks @Kylotan for moving to the lounge. :-)
      Assuming folks here would have more familiarity than on SO.  I recently purchased an AMD/ASUS/RX570 bundle and I'm running Chrome Beta.  It works but my frame rate is slow, <5pfs.  FF works fine.  I formerly found some things to try, but completely different system/problem.

      Google chokes on anything I put in related to rx570 and considering I was lucky to get one, I wonder if anyone here has seen similar issues and been able to track down some settings or knew what to try to get chrome over it's foolishness?  A link/resources?
       
      I updated drivers.
       
      Looking forward to getting into webgl.
    • By Gabriel_Solon
       Hi, this is a fighting project that im making for a month now.
       
       
      The game mechanics work like this:
       - There are 3 stances, low, mid and high, each one starts a combo, it also blocks any attack coming from the same stance.
       - Special Attacks are unblockable unless a Special Defense (dashes or parries) is engaged       -(Not yet properly implemented)
       - Special moves have a 5 second cooldown
       - I intend on having 3 characters with distinct weapons and fighting styles based on Historical/Mithical personalities
       
       Tell me what do you think
    • By NeroGame
      hey everyone!
      so im trying to create an in game shope to spend the in game currency and i want the kind of shop that when you touch the skin you unlock it and select it (i've tried several ways didnt work only with a button ) so can anyone please help
    • By Strychnine
      As my title says I'm experience web developer that's been doing so for 20 years as a hobby and 10 years professionally. I dabble in tons of languages and frameworks and I'm not afraid to look at any.
      I've worked in some .NET stuff for some websites so I could probably have less learning curve with C# but I'm completely willing to work in C++ as well. In general I love programming stuff and figuring out things. Especially ones I broke. 
      Ideally I'd like to work in a team either looking to learn together or something very patient and laid back. While i'm a very good programmer in the web sense I know I will need to learn some things on the application side. So patience and a group not looking to run to steam immediately would be ideal. I've watched videos and am continuing to, but I know I always just work better hands on and sadly i'm not as artistic as I like to be.
      Thanks for your time.
      Current skill list: PHP, MySQL, Moderate C#, ReactJS, VueJS, NPM, LEMP/LAMP/IIS Server stacks(not relevant here but I understand server administration as well), as well as other stuff here and there but these are the most dominant things I work in.
  • Popular Now