Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
-1
Question by skully42 · Feb 23, 2012 at 11:41 PM · enemywallfloor

Problems with enemies

Hey guys i need help. I am making a game where a robot chases the player(you) and tries to kill it and you kill them like a zombie game. So here is the problem the robot in unity are not realy solid. They can walk on the floor but they go through walls, when they walk helf of there body is in the ground, and somehow they can fly when i am on a object. If you can help me with any of these problems that would be great. Thanks

Comment
Add comment · Show 5
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 Travis 18 · Feb 24, 2012 at 12:08 AM 2
Share

Can you post the code for your enemy movement and collision? It could be a number of issues depending on your implementation

avatar image skully42 · Feb 24, 2012 at 01:36 AM 0
Share

everything is in unity i didnt chnang or write my own script

avatar image Default117 · Feb 24, 2012 at 01:58 AM 1
Share

Well theres one problem

avatar image Travis 18 · Feb 24, 2012 at 05:31 AM 3
Share

Oh okay. Given that information, I quantum leaped into your body, assessed the situation, performed a good deed and leaped back into my own. I can tell you that everything is working as it should--robots are supposed to sink into the ground and be non-solid by design (as of Unity 2.6). Good job!

avatar image skully42 · Feb 24, 2012 at 03:05 PM 0
Share

do you want the script if so which one

6 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by kievar1983 · Feb 24, 2012 at 03:59 PM

hey skully42, seems like a few people are berating you on here. to answer your what do you want me to do. refine your question.. what have you tried? have you coded any scripts? if so what are the scripts? are you attempting to use collision? was the enemy made in a software application such as 3ds max or maya? if so did you put a mesh collider on it?

these things help us help you. telling us everything you've done will help us find a quick solution to your issue.

from what i have read it sounds like you have a enemy that has no rigid body or box collider on it so it doesn't do any collision detection.

Comment
Add comment · Show 6 · 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 skully42 · Feb 24, 2012 at 07:20 PM 0
Share

i didnt change or rewrite a script i used the enemy from unity and it can walk on the floor but half or its body is in the ground and i tried putting a collider and a rigidbody and it just falls through the floor i have no idea what to do now i am new to this if you have any questions just ask and i will get back to u as soon as possible

avatar image MithosAnnar · Feb 24, 2012 at 07:34 PM 0
Share

Well, then you can just move the enemies y position up above the floor, so it doesn't fall through.

avatar image kievar1983 · Feb 24, 2012 at 07:36 PM 0
Share

agreed with mithos, just move the enemy up until it is above the ground then it shouldn't fall through. i usually set the Y to like 1.5 or 2 and let gravity bring it to the ground, if there isn't gravity then i would manually position it.

avatar image skully42 · Feb 25, 2012 at 01:35 PM 0
Share

maybe i wasnt clear and i am srry for that they dont fall through the floor but as the robots start to chase me half of their body is in the floor

avatar image MithosAnnar · Feb 25, 2012 at 01:43 PM 0
Share

ok, so copy and paste the 'chase' code underneath this comment.

Show more comments
avatar image
0

Answer by Default117 · Feb 24, 2012 at 12:16 AM

http://answers.unity3d.com/questions/206576/enemy-problem.html

http://answers.unity3d.com/questions/211889/enemy-help.html

http://answers.unity3d.com/questions/220382/solid-enemy-help.html

Maybe stick to just asking the question once and revisiting it? Plenty of people have offered advice already, maybe you should look more into that before asking again and again?

Comment
Add comment · Show 3 · 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 skully42 · Feb 24, 2012 at 01:35 AM 0
Share

i tend to find people answer the questions that havent been answered the other one didnt get a answer in a few weeks

avatar image Jason B · Feb 24, 2012 at 02:04 AM 2
Share

To be fair, that's because it's a vague question that exhibits no knowledge of game design, no knowledge of Unity, and no use on your part of the Unity manual, and so the answer required to satisfy your needs would end up spanning across a small novel. You need to learn to write your own scripts, first off. Saying "Hey guys there's a problem with a script I didn't write because I have no program$$anonymous$$g knowledge" is pointless, because even if we gave you code to fix it, you would learn virtually nothing, thus you'll be back here every single time you have a basic question. Unity is not a game engine where you can "click together" a game (or even a working demonstration) without any technical knowledge whatsoever, and too many people come here to learn that the hard way.

avatar image skully42 · Feb 24, 2012 at 03:05 PM 0
Share

so what do you want me to do

avatar image
0

Answer by MithosAnnar · Feb 25, 2012 at 07:53 PM

Ok, not to fear there skully. And don't worry about the format its fine.

Attach this script to your robots:

chase.js:

 var target : Transform; 
 var moveSpeed = 3; 
 var rotationSpeed = 3; 
 var myTransform : Transform; 
 
 function Awake () {
 
     myTransform = transform; 
 
 }
 
 function Start () {
 
      target = GameObject.FindWithTag("Player").transform; 
 
 }
 
 function Update () {
 
     myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 
     Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
 
     myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
 
 }

Comment
Add comment · Show 5 · 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 MithosAnnar · Feb 25, 2012 at 08:32 PM 0
Share

If I got something wrong or you received an error tell me cause I haven't tested it.

avatar image skully42 · Feb 26, 2012 at 12:04 AM 0
Share

no errors but i didnt get a change what was it supposed to do

avatar image MithosAnnar · Feb 26, 2012 at 11:20 AM 0
Share

So they still fell through the floor?

avatar image MithosAnnar · Feb 26, 2012 at 11:21 AM 0
Share

Try putting a box collider on your floor.

avatar image skully42 · Feb 26, 2012 at 03:47 PM 0
Share

no no no they dont fall through the floor its just half of their body ends up going into the floor while it chases me

avatar image
0

Answer by Kergal · Mar 07, 2012 at 12:16 PM

:) did you adjust the character collider ? - on default it is usually not set to fit your character. Click on your Enemy in the hierachy - and look up its character collider - set the y value a bit higher.. and make sure most of your character is surrounded. That should stop your enemies from walking through the floor and foor the rest... idk :)

Cheers Kerg.

Comment
Add comment · Show 1 · 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 skully42 · Mar 11, 2012 at 02:13 AM 0
Share

i already did that but thanks for the help i guees

avatar image
0

Answer by Kergal · Mar 07, 2012 at 10:10 AM

just adjust your enemies CharacterController. it is that green wireframe thing - it defines the whether your characters sink into ground or not. Click your enemy - look up the CharacterController adjust the y value (usually put in a higher number) push play - see if its alright - if not .. play with the numbers a bit. Should do the trick. or even better ;) write a script to do it for you ;) something like.... http://unity3d.com/support/documentation/ScriptReference/CharacterController-height.html instead of hardcoding you could use a public variable --> then you can play with the value in the inspector. and maybe you want to look up http://unity3d.com/support/documentation/ScriptReference/CharacterController-radius.html --> define the radius http://unity3d.com/support/documentation/ScriptReference/CharacterController-center.html --> my personal favorite. creates a dependency between the transform and the controller.

I hope 90 % of what I wrote is alright. I am a newbie as well ;)

Cheers Kergal

Comment
Add comment · Show 1 · 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 skully42 · Mar 11, 2012 at 02:19 AM 0
Share

thanks for you help but i know a little scripting but i dont think i cant write a realy long script and i trted moving the charactercontroller and it didnt work any other ideas would be great

  • 1
  • 2
  • ›

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.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Problem with enemy health. 1 Answer

Solid enemy help 1 Answer

Enemy Spawning Place 0 Answers

Enemy Death and Killing Script 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges