Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Yisreal · Feb 18, 2010 at 03:56 PM · collisionmovementcolliderpositionlerp

Object collider not operating properly

Using this function I have been able to make an object float to a destined position, how ever, should this object come to a wall or any object that has a greater mass than it, there is no proper collison and it knocks the other object away or goes right through it.

how can i tell this object not to go through others or push over others during this procedure. all object have colliders that work.

function Lerpme(start : Vector3, end : Vector3, speed : float, t : float, start1 : RaycastHit){
        start1.transform.position = Vector3.Lerp(start, end, Mathf.SmoothStep(0.0, 1.0, t));  //function for lerpmove
        yield;
}

Thanks a ton!!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Eric5h5 · Feb 18, 2010 at 04:21 PM

If you explicitly set the position of an object like that, collisions can't work. You have to make it a rigidbody and then apply forces, such as with AddForce and so on, so the physics engine can work properly.

Comment
Add comment · Show 1 · 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
avatar image cregox · Feb 19, 2010 at 08:48 PM 0
Share
  • (except my daily vote limit is over :o) - @Yisreal And be warned it will be no easy work.

avatar image
0

Answer by cregox · Feb 19, 2010 at 08:53 PM

That problem happens because explicitly setting the position overrides the Physics on the object. Like Eric said, you want to add a rigidbody and apply forces or you can even try toying with its velocity a bit.

From my comment @Eric5h5 I meant it will be no easy work if this object actually need to do anything else than "float to a destination point" like stop on it, or bring something along.

If it's just reaching it, then just use AddForce rather than the Lerp. It will throw the object and physics will do the rest. Try it, you will see. ;)

Comment
Add comment · Show 2 · 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
avatar image Yisreal · Feb 20, 2010 at 09:00 PM 0
Share

It works great! thanks!

avatar image cregox · Feb 24, 2010 at 12:03 AM 0
Share

Glad to know that. ;)

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

No one has followed this question yet.

Related Questions

Transforming position for different colliders for repeating background? 0 Answers

player collite with object and start moonwalking 1 Answer

Collision Issue - Walk Through Object 0 Answers

What is wrong with this script ? if duration is 10 why the transform is moving in 11 seconds and not 10 ? 1 Answer

Movement with collision detection but without a CharacterController 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