Recommended Posts

KnowItAllGames    114

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 this post


Link to post
Share on other sites
Scouting Ninja    3954

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 this post


Link to post
Share on other sites
KnowItAllGames    114
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 this post


Link to post
Share on other sites
Scouting Ninja    3954

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 this post


Link to post
Share on other sites
KnowItAllGames    114
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

Share this post


Link to post
Share on other sites
Scouting Ninja    3954

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.

Share this post


Link to post
Share on other sites
KnowItAllGames    114

 

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

Share this post


Link to post
Share on other sites
Scouting Ninja    3954

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 this post


Link to post
Share on other sites
KnowItAllGames    114
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 this post


Link to post
Share on other sites
Scouting Ninja    3954

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

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 LucKet
      Hey guys,
      I'm quite new to game development (had two small projects in university with Unity and libgdx and wrote quite a bunch of Minecraft plugins and mods but that's mostly it) and want to expand my knowledge in a cool project. I'd love to find a project I'm passionate to work on. I personally don't play any browser or mobile game, thus I'd prefer a desktop game. I'd love to dig into fields like graphics (already had DirectX in university but would love to learn more), AI and general game programming. I'm mostly playing open world, RTS, tycoon, simulation and MOBA games but am open to new genres and ideas. It doesn't have to be a game, if you have an interesting project like an engine or something else just tell me. Even though I'd love to be a proud player of the game we will create.
      If someone has a cool project just PM me, I'd love to hear about it and hopefully it will enthrall me as much as you!
    • By winnex RD
      Hello  forum.

      Am migrating a WD7 to WDK 10 (Environment is  Visual Studio  2015, Windows  10, windows Driver).
      In windows Driver filters are Folder capture.ong is the visual studio enviobement while  wdk7 folders is the original WDK7 folders.
      I just created a filters  and created the  necessary  files inside.
      I do want to know if i am doing the right thing.

      If am wrong would  gladly appreciate correction.
      Attached  are the  snapshots of my environment
       
      Thank you


    • By tope awolowo

      Good day  forum.

      Am trying to connvert a WDK 7 project (https://github.com/basil00/Divert. windowsdivert ) to WDK 10 (Environment is  Visual Studio  2015, Windows  10, windows Driver).
      In the template for  windows drivers Visual Studio  2015 which are :

      Kernel  Mode Driver (KMDF)
      Kernel  Mode Driver (KMDF)  EMPTY
      User  Mode Driver (UMDF V2)

      User Mode Empty  (UMDF V2).
      What is stressing is this, Would like to know  which should i use to start and populated the project.
      Should i use the Kernel  Mode Driver (KMDF)  EMPTY, then  populate it  with codes  from Windivert 
      Which  driver   template  should i use.
    • By Jesse "Chime" Collins
       

      This is only the beginning, VRm I right?
      Not unlike an arms race, the VR price war has only begun. Who has the best Equipment? Early this Summer, Oculus had a massive sale on their device, the Oculus Rift, ending in a permanent price drop. HTC is now following suit, cutting out the sale, dropping the price altogether on their Vive Head-Mounted Display.
      Yesterday, The HTC Vive took a hefty slash in price, dropping from their $799 price tag, down to $599. This comes as no surprise after the Oculus Rift dropped down to $399 earlier this Summer on sale. At the end of the sale, the price raised back up to $499 as the final price, $100 less than previous to the sale.
      The HTC Vive comes with plenty of their worth for the price, too. Along with the head-mounted display, accessories include two wireless controllers, two bases stations, comfort-related materials, and everything purchasers need to get going (cords, etc.). Additionally, the system comes with Google Tilt Brush, Everest VR, and Richie’s Plank Experience as promotional content, as well as one-month subscription to Viveport.
      Vive's Giving Away Some Free Content For New Owners

      As a breakdown of the free content, purchasers of the Vive get $53 of extra content from the promotional pack. Google Tilt Brush ($19.99 retail value) gives artists a full 360-degree canvas to paint massive murals and masterpieces. Everest VR ($14.99 retail value) allows people to climb Mount Everest in first-person, without the fear of dying from hypothermia. Richie’s Plank Experience is a starter “game” for new VR players, teaching balance using VR, as well as giving a couple extra modes like a sky-writing experience.
      But, that’s not all! Purchasers of the $600 system also get a free 1-month subscription to Viveport, HTC’s subscription service, valued at the incredibly pricey $6.99. Subscribers can choose five games/experiences to try out during their subscription period, with five more for each additional subscribed month. The list to choose from includes some amazing titles like ROM: Extraction, which has players shooting robots in a space station. But, people should research their potential options to maximise their potential. For instance, players can also choose the (somehow) award winning title, BUTTS: The VR Experience, which may or may not push virtual reality to its foremost limits (spoiler: it doesn’t).
      But, What About Me And You?

      The question to ask is “What does this mean for potential VR buyers?” Well, the war is in motion here, showing both of these price drops. Virtual Reality enthusiasts and companies are pushing that VR is the future. With this price drop, the Vive finally becomes more affordable to the masses, as well as the even more affordable Oculus Rift. But, alas, other companies are starting to get in on the game, as well.
      Some people just want entertainment instead of gaming. Artists want whitespace to create. Experiences can be strapped to a face for cheap. Google, the folks that bring the Daydream to the VR market, is pushing their own boundaries by teaming up with HTC and Lenovo for cost-effective standalone experiences. Microsoft’s HoloLens will take users into augmented reality, albeit from a much higher price. VRotica, an erotica-enabled standalone HMD device already on the market, costs a fraction of the price of other HMDs.
      Essentially, VR is getting cheaper. For those that have a device already, awesome. The experiences are unlike anything ever before. For potential buyers, as with all technology in history, VR is getting cheaper all the time. Thousands of games and experiences inhabit the SteamVR storefront and respective virtual shops.
      “VR Ready” Computers are coming down in price as well, eventually making the idea a non-issue. But, the average joe still has to fork out some cash for a game-capable machine, because cheap computers still can’t handle it. VR, at the moment, is for the elite, but it won’t be for too much longer.
      Is it the perfect time to grab a now $599 Vive, a recently dropped $499 Rift, or should buyers wait it out for even better prices and devices later?
    • By notrodta
      Hi, I'm currently developing a game with a friend on Unity. We have the majority of our first prototype ready. We are searching for a 2d artist and a musician. If you are interested, feel free to contact us. We also have a demo of the game we can send you for those of you who are interested.
      If you want to know more about this game, you can check out this post:
      https://forums.tigsource.com/index.php?topic=61923.msg1347252#msg1347252
      Below is a short youtube video containing few clips of our game:
      https://www.youtube.com/watch?v=YcvwbeGeIrw
       
  • Popular Now