• 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 markrashera · Mar 27, 2016 at 09:29 PM · movementphysicsrigidbodyaddforcemove

Player going through walls

Hello everyone. i searched the whole internet and found no answer. so i'm gonna ask here. i have my player which is moved by this part of the script: Player.GetComponent().AddForce(Player.transform.forward * 20);

The player has a rigid body on him. the rigid body is not kinematic but has disabled gravity. In that part of the script i want my player to keep going forward and he does. but he goes into walls.

And i can't move my player with the character controller move option, because i disabled my character controller because i need to move my player on the y axis and the character controller doesn't allow that.

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 Dibbie · Jun 14, 2016 at 07:39 AM

Make sure you also have some type of collider on your player, be it a box collider or capsule collider (most common for characters), etc... What a Rigidbody does, is essentially adds physics to an object, the collider will allow those physics to be affected by the world or anything that should essentially have a "mass" of some type to it.

The object you are colliding with (in your case, the walls) should also have the same idea on them, at least a Rigidbody, and its always a fail-safe to add a collider as well, cause most often, you are missing one or the other on one of the 2 objects you are trying to get to collide properly.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Ball Speed is not increasing as per code 0 Answers

AddForce in Coroutine 1 Answer

How to change the direction of a rigidbody without adding to its speed? 1 Answer

Script makes plane point in general direction but doesn't point fully... read description please! 1 Answer

Realistic Soccer Ball Dribbling? 1 Answer

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