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
0
Question by Benjam · May 05, 2013 at 12:00 PM · collisionphysicsslerp

How to use something like SLERP but with continuous physics

Hey there. I am having a little trouble with my slerp function at the moment. When you hold down the X button on the controller you can zap a target towards you and when i reaches abotu 5 meters away from you it stops and you can then control the object around you in an arc by using SLERP and the controller joysticks.

The only issue i am having is that the physics are gone as soon as it enters the SLERP function. I have seen some pointers on the forums saying that because I am directly changing the objects position the physics are cancelling out. Is there any way to use something like SLERP for the arc type effect I am trying to achieve but with Physics attached?

Here is a quick diagram to illustrate what I am trying to do: alt text

And here is my SLERP function: //controls the arc that the object is kept in void slerpFunc() {

         float damping = 2;
         //limits the Slerp function to the centre point of Roybot
         
         //sets up 3 vectors the start position and the end position for the interpolation
         //and the center point 
         Vector3 centre = transform.position;        
         Vector3 startPos = transform.position + new Vector3(0,0,5);
         Vector3 endPos = transform.position + new Vector3(0,0,-5);                
         centre -= Vector3.up;        
         Vector3 startRelCentre = startPos - centre;
         Vector3 endRelCentre = endPos - centre;
         
         //I am overriding the physics with transform.position. Need to find a better way to do this!!        
         target.transform.position = Vector3.Slerp(startRelCentre, endRelCentre, rightThumbValueY/damping);
         target.transform.position += centre;
     }


If anyone has come across this before or can help in any way it would be much appreciated!

Cheers :)

slerp help.jpg (19.6 kB)
Comment
Add comment · Show 1
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 robertbu · May 05, 2013 at 05:29 PM 0
Share

I saw an interesting suggestion go by on this list concerning this issue, but I'm out of town and cannot test it. The idea was to move an empty game object and attach the physical game object to the empty game object using a spring joint.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by gharbill · May 06, 2013 at 04:57 AM

If you want to maintain physics you have to do it physically A simple trick can be creating a high gravity source like a magnet object which can be controlled by your slerp and then assigning the rgidbody you want to controll to be affected by that magnet. Tell me if it worked ;)

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.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

collision with objects, physics 1 Answer

Having trouble with Physics.IgnoreCollision(). 1 Answer

Fist Passing Through The Target 2 Answers

RAYCAST KNOWLEDGE HELP!!! 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