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
      Arena Of Glory
      a mobile moba game
      The Idea
      There's a lot of mobas out in the market right now. On PC at least, most don't do any good. The big 3 (LoL, Smite, Dota2) outshine any new moba coming out, but it's a different story when it comes to mobile gaming. The only quality moba game on mobile at the time of writing this is Vainglory, a 3v3 battle arena game "perfected for touch". The rest are cheap league of legends clones some of which literally use stolen models and sound effects. I'd like to create a better moba on mobile phones. Something that you can truly play anywhere without having to bring your iPad to play comfortably like Vainglory. A moba game truly perfected for touch with a 5v5 battle mode.
      The Team
      Currently there's 2 people in the team, possibly 3 (talking to possible concept artist as I write this). We're both programmers. It's always been our goal to make games. After some school and more self teaching, we have finally made it to a point where we can write games.  Of course, you might see right away how this is an issue. We can't do art. I mean I have tried but I can't do anything digitally.
      Current Progress
      Well, we have been working on the game for a 1 and 3-4 months. We have most of the core features done and even have temp maps put in place to test along with cheap 3d models. The game is working, only that in it's current state it can only do 3v3 battles. (Originally we were going to keep it 3v3 but later changed our minds.) We have a poorly made UI that is not appealing in any way, but can get the job done as we continue. 
      We have: Nickname choosing , friends list, tutorial for beginners,  gold: currency gained through playing and premium currency (in app purchase) to buy skins, etc. Hero list, 3v3 battle mode.. we have most of the core done.
      What's left: Implement 5v5 battles, World Chat, User Registration check (so that you never lose your account), new UI/UX/HUD & New artwork (new hero concepts, 3d models, logo, etc). 
      What we Need
      I realize this is a big project. We need people who are passionate about game design/development. People who can stick around because they love the project or just love game making in general. There's a huge opportunity for us in the mobile market and we want to offer revenue share and equity to artists and programmers that would want to jump on board. Stick through and you'll see that your time will not be wasted. 
      How to contact
      I guess you can PM me here or add me on Discord @ Altri#7510.
      You may also email me @ plus5interactive@gmail.com.
       
      Thank you so much for your time,
      Altri
       
      [SCREENSHOT ADDED]
      Keep in mind we don't plan to use any of our current assets. We want everything made organically by our team and have our own unique style.
       

    • 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