Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
2 captures
11 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 Carrel · Jul 22, 2015 at 12:43 PM · collisionrigidbodytransform.position

Managing collision with transform movement

Hello all, We've recently had an intern that has developed a script to simulate diving, it's very complicated and well done, and now it's my job to implement this script. The only problem is that this script does not use rigidbody or characterController, it changes directly the transform position. This is a problem when it comes to managing collision, as for the moment, we can pass straight through the sea floor and rocks etc... The script has been worked on for a long time, and I would much rather not have to redo/change it allot to use rigidbody or character controller. Does anyone have any suggestions and the best way to manage/mimic collisions without rigidbody or charactercontroller?

Thanks in advance.

Comment
Add comment · Show 5
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 Theinsanekiller · Jul 22, 2015 at 12:50 PM 0
Share

you can write your own collision system then and thats pretty complicated work. or you work with distance, directions and all.

avatar image maccabbe · Jul 22, 2015 at 01:19 PM 0
Share

It'll probably be easier to redo the script using a rigidbody than write your own collider.

avatar image game-dev333 · Jul 22, 2015 at 02:14 PM 0
Share

collision will detect if one of them have rigidbody

avatar image _dns_ · Jul 22, 2015 at 02:51 PM 0
Share

Hi, you can ask Unity if an object is colliding another with the Physics.CapsuleCast or CheckSphere and then react to it yourself (as well as the RayCast functions).

Something else that may be more simple is use a rigidbody but manage it's dynamic yourself and let Unity handle collisions and collisions reactions. To do that, set the gravity to 0 (I guess you handle it yourself). In FixedUpdate, do your computations to get the new position of the object according to your dynamics. Compute Vector3 deltaPosition = newPosition - transform.position. Then, assign the rigidbody.velocity to deltaPosition * 1.0f/Time.FixedDeltatime. Unity will compute the new position using this velocity and it should end up positioning the rigidbody exactly where you computed the new position. If there is an object blocking the way, your object will react to the collision, then ending not exactly where you wanted it but well, there was a collision so... ;-)

avatar image Carrel · Jul 27, 2015 at 09:38 AM 0
Share

Thank you for your suggestion, I've attempted using rigid body.position and rotation ins$$anonymous$$d of transform.position and rotation, it does stop when colliding but with other strange results, if i keep trying to go through that wall i will pass and then all hell will break loose with vibration and jumping. and I did try the newPosition - transform position and setting the velocity, only the object doesn't move at all, I must be taking the transform in the wrong place or something silly, so will retry that! I think using recasts could be a good option, and I'm going to look into Physics.CapsuleCast and CheckSphere. Thank you @dns When/if I find a way, I will post how I got there

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

the player don't move with the transporter,,The occurrence of the player from the carrier 1 Answer

OnCollisionEnter doesn't work if enemies and allies have rigidbody ? 1 Answer

Rigidbody: how to get collisions for the current frame ? 0 Answers

how to make an Explosive rigidbody trigger by another collision box 0 Answers

Car dynamics? 0 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