Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by nzcontak · Apr 23, 2015 at 04:03 PM · c#collisionvelocitytranslatemagnitude

Move until collision sticks

Hi there. I searched on the forum and saw many questions regarding this issue, however I wasn't able to fix my problem or find a particular solution for it. I found a way for it to work but it's not optimized and I think it's too complicated for what it should be.

First of, I am making a game in which there's 2 players. One of them has 30 seconds to chase the other one. If he succeds, he scores a point, if he fails, the roles switchs. Once you have made a movement, you cannot move again (very important). My game is in 2D view (I scripted in 3D but I'm going to switch everything in 2D). Here's a look at the prototype.

alt text

To download the build (use the "test" scene) : https://mega.co.nz/#!tZ8kySpR!xt_OMFpnHASx9U_AGitcch5yB23gCZ6liqRp9gwMlg4

For this version, there's a rigidbody on both players and my script detects the Axis used to move it towards a direction. It adds velocity in a direction but before I check if the magnitude is 0 (so it only moves when the object is stopped).

The thing is, its kinda sticks to the wall and the response time before making another move is too long. It breaks the gameplay and I would like it to be faster, more reactive. What I liked about using that, is that I could collide with 2 walls at the same time and still be able to move.

I tried putting blocks for triggers and move the object until it collides with the trigger, but I didn't find a way to still move if it was colliding with another wall (corners were a real pain).

Do you guys have a suggestion that could be implemented or more optimized? I had the idea to use Raycast but I'm not really familiar with those and didn't want to invest time in that since it was "working" with the velocity.

I have the impression it should be easier. Would it be if I switch to 2D? At start I though I could only uses translates (translate left until collision) but I found out it wasn't as easy at it seemed. Our big inspiration is Toto Temple gameplay video, if the movements could be similar but without the gravity, it would be perfect.

Thanks in advance for your help!

11159235-10155421654815537-610858874-o.jpg (70.5 kB)
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

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

2 People are following this question.

avatar image avatar image

Related Questions

Rigidbody magnitude comparison is not working correctlly? 2 Answers

Unity3D: Get Velocity after collision 0 Answers

Multiple Cars not working 1 Answer

OnCollisionEnter for translating gameObjects? 2 Answers

void OnCollisionEnter(Collider other) { if (Rigidbody.velocity.magnitude > 5) {...} - In "Rigidbody.velocity.magnitude" asks to give link to the object??? 2 Answers


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