Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
0
Question by jknight-nc · Sep 05, 2016 at 07:54 PM · movementphysicsrigidbodyplayerplayer movement

Player is Speeding up in collisions

Hey there, I have a simple top down shooter Im working on.

Players can destroy the walls and then the debris will litter the level.

When the players run through the debris, they are speeding up. I don't know why this is happening.

I am using forces to move the players.

When I use ForceMode.VelocityChange, the players speed up when they are colliding with the level's debris:

     Vector2 force = direction * movementForce * Time.deltaTime;
     m_rigidBody.AddForce(force.x, 0.0f, force.y, ForceMode.VelocityChange);

When I Use ForceMode.Acceleration, the players slow down when they are colliding with the level's debris. Problem here is that they are slowing down way too much. To solve this, I changed the players rigid body mass to 2000 and the debris to 0,1. Player drag is 4, debris drag is 0.01.

I can't seem to find some values where the player just barely slows down when running through debris.

Comment
Add comment · Show 2
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 Spartiate0033 · Sep 06, 2016 at 12:55 AM 0
Share

I think your problem is two fold here. You don't have enough code provided to give a full answer so I will request you post how you activate when the player hits debris, you might be accidentally applying it multiple times.

As for slowing down the Player, you're going to want a speed modifier that can adjust the final result of force before it is assigned. I'm working on a similar game but it doesn't use force, just a simple translation. So what you'll want is to do is modify the speed based on the type of object it is colliding with.

 float step = (m_$$anonymous$$axSpeed * Time.deltaTime) * m_Speed$$anonymous$$odifier;

This is code from my game. So as you can see, the m_Speed$$anonymous$$odifier will effectively slow down the object when it walks on the debris. So you might have the m_Speed$$anonymous$$odifier = 0.25 or something when walking in debris, making the character walk at 1/4th the speed.

avatar image jknight-nc · Sep 21, 2016 at 05:38 PM 0
Share

I am using rigid body forces and dont want to use a custom "speed modifier".

I think the Player is "speeding up" because his collision with the cube causes him to leave the ground, and then in the air he has no ground friction and moves quicker. I thiiink thats what's happening.

Ultimately I made it so the debris applies no force to the Player's rigid body, and the player just pushes them around with impunity. It's funner this way.

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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Rigid body child Player movement 0 Answers

Collisions causing Rigidbody to go Haywire and move randomly. 1 Answer

Issues Making Character Move With Rigidbody 1 Answer

A simple solution for constant rigidbody movement without changing and clamping velocity directly 2 Answers

Non slippery movement 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