• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by Killhatch · Nov 12, 2012 at 01:07 PM · collisiongravityridgidbody

rigidBody collision with wall stops vertical movement.

I am using the code below to move a group of GameObjects. The script is on an empty GameObject which also has a RigidBody component. One of the child GameObjects has a BoxCollider component.

The problem

When the gameObject is above ground (in free fall) and collides with a wall, the gameObject gets stuck if the user is moving towards the wall making the object "cling" to the wall at the collision point. I want it to continue falling. How do I stop it from halting on the side of a wall?

The code

 void FixedUpdate()
     {
         velocity = rigidbody.velocity;
         velocity.x = Input.GetAxisRaw("Horizontal") * moveSpeed;
         velocity.z = Input.GetAxisRaw("Vertical") * moveSpeed;
         rigidbody.velocity = velocity;
     }
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 sparkzbarca · Nov 13, 2012 at 02:15 AM

that seems wierd, are you looking for an in depth complete answer or a quick hack? Cause the quick hack is on collision if falling knock there ass back a quarter inch.

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

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

10 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

Related Questions

Sphere disappears!!!!! I downloaded 3D model assets from web and made a "decoration" game object...... 0 Answers

How to make player collide with ground? 1 Answer

Stopping objects with colliding with similar objects. 1 Answer

Gravity and physics problem 1 Answer

Levitating character and failed collider problem 1 Answer

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