• 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 /
  • Help Room /
avatar image
0
Question by Zikovic · Nov 19, 2017 at 02:37 PM · playercontrollermodelavatarcontrollers

Charachter goes trough everything even the terrain :(

sup guys i was wondering if anyone could help a newbie , i'v just finished building a large map for my survival game and just finished with some animations on AI / Player model. only the player model have that problem it goes trough everything , i'v did a little bit of testing and changed to a mouse rotation , and stil i rotate it down in ground charachter (player model) keeps going down . it walks like there is no psyhics :(

Here is the controller code wish someone could help me out to fix it :( using System.Collections; using UnityEngine;

 public class Zombiecontroll : MonoBehaviour {
 
 
 
     static Animator anim;
     public float speed = 10.0F;
     public float rotationSpeed = 100.0F;
 
     //Mouse Look
     public float horizontalSpeed = 2.0F;
     public float verticalSpeed = 2.0F;
     //End of moouse look
 
     
     // Use this for initialization
     void Start ()
     {
         anim = GetComponent<Animator>();
         
     }
 
     // Update is called once per frame
     void Update()
     {
 
         float translation = Input.GetAxis("Vertical") * speed;
         float rotation = Input.GetAxis("Horizontal") * rotationSpeed;
         translation *= Time.deltaTime;
         rotation *= Time.deltaTime;
         transform.Translate(0, 0, translation);
         transform.Rotate(0, rotation, 0);
         
 
         if (Input.GetButtonDown("Jump"))
         {
             anim.SetTrigger("anim_Jump");
         }
 
         if (translation != 0)
         {
             anim.SetBool("anim_Running", true);
             anim.SetBool("anim_idlee", false);
         }
         else
         {
             anim.SetBool("anim_Running", false);
             anim.SetBool("anim_idlee", true);
           /*  {
            /* }
                 //mouse look start codes
                 float h = horizontalSpeed * Input.GetAxis("Mouse X");
                 float v = verticalSpeed * Input.GetAxis("Mouse Y");
                 transform.Rotate(v, h, 0);
                 //mouse look end coding 
                 */
 
             }
         }
     }
 


Sorry for my bad english, i just started like 4 months ago with unity and had a nice idea to create a survial game :( i'm lost of hope already, been 24h awake to try sovle , not even google helped me

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ValakhP · Nov 19, 2017 at 09:16 PM

Check if you have collider and the rigidbody on it. Also check if all obstacles have colliders.


You can learn more about it here: https://docs.unity3d.com/Manual/PhysicsSection.html

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 Zikovic · Nov 22, 2017 at 09:12 AM 0
Share

thank you , but anyways i rescripted the whole charachter controller the one i posted was a mess at all , now i finally optimized the player movament , and fixed the bugs aka ; stop in middle of air while jump from high buildings and more :)

fast tip to anyone reading this post make yourself a nice conroller and give him commands what to do :)

aka; took me about 4 scripts to make it work perfect but i'm proud of my work

ValakhP thanks for helping me out , the collidier and rigidbody are outated on transform codes :) its better to force the player movament and apply animations trough Animator :) just sorted it out after looking many yt tutorials by holistic3d this woman is the power of Unity <3

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

135 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I need to control my player using a joystick. I used the default joystick script in Unity, but i am not able to integrate it with the player. Please help. I am attaching the player script, its currently using keyboard input 0 Answers

Object Player Movement stops working after Restarting Unity 0 Answers

any tutorial for playercontroll, physics ? 0 Answers

Player (Using Player Controller) slow falls when I repeatedly press the jump button while falling., 0 Answers

How to create dynamic animator controller (state machine, transtion etc) with .fbx files by using c# script 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges