• 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
Question by Noktai · Jul 02, 2012 at 10:53 PM · 2dcollisionplatformer

Tilegrid platformer collision

Hello,

I'm experimenting with unity for a tilebased 2d platformer. The level is build out of an array of ints, where each int represents a cube with a box collider (the tiles). The boxes are perfectly alligned next to eachother. Both the tiles and player's position is locked on the Z axis, and the rotation on all axis.

However, when the player walks over a horizontal set of tiles he suddenly jumps up at some points. It's as if he "trips" over one of the boxes, even though they should just behave as one big box collider. This problem does not occur when I use one big collider.

You can view a very simple sample here. https://www.dropbox.com/s/jxupnw2ivsc1mih/platformer.swf

The first section is one big box collider, the crates are seperate box colliders. To reproduce the problem, stand on one end of the crates and single tap A or D to move to the other side.

Here is the character control code just to be sure

 using UnityEngine;
 using System.Collections;
 
 public class Ball_Script : MonoBehaviour {
 
  // Use this for initialization
  void Start () 
  {
  print("started this shit");
  }
  
  // Update is called once per frame
  void Update () 
  {
  Vector3 velocity = rigidbody.velocity;
  
  
  if (Input.GetKey(KeyCode.A))
  {
  rigidbody.velocity = new Vector3(-10, velocity.y, velocity.z);
      }
  
 
  if (Input.GetKey(KeyCode.D))
  {
  //rigidbody.velocity = new Vector3(10, velocity.y, velocity.z);
          
      }
  
  if(Input.GetKeyDown(KeyCode.W))
  {
  rigidbody.velocity = new Vector3(velocity.x, 5, velocity.z);
  print("woop");
  }
  }
 }
Comment

People who like this

0 Show 0
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

0 Replies

· Add your reply
  • Sort: 

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

OnCollisionEnter not called when colliding with clone 0 Answers

Player color change on collision -1 Answers

My sprite keeps falling through my ground 3 Answers

Dropping down from 2D platforms: Character gets "sprung back" if collision resumes mid-collider 1 Answer

How to make character stop at wall? 1 Answer


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