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 andy_the_baker · Feb 07, 2010 at 09:09 PM · triggerplayerlerpslerparc

Moving player in an arc, from startPoint to endPoint

hi.

fairly new to unity, with some minor experience in programming.

i've set up a trigger region (the start point), which contains a target (transform) that i'm trying to toss the player character to (like a catapult).

i've tried using this setup but it doesn't work for me:

http://unity3d.com/support/documentation/ScriptReference/Vector3.Slerp.html

i've also tried a series of Vector3.Lerps, but don't think that's the smartest way to go about it.

also: i cannot for the life of me get this to play out for longer than a second, no matter what i multiply Time.time or Time.deltaTime with (from .0000001 to 1000000). do i need to move this function outside of function Update?

any help would be greatly appreciated. i've been stuck for about a week! :) thanks.

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
1
Best Answer

Answer by runevision · Feb 08, 2010 at 10:54 AM

See this these questions for multiple solutions:

Throwing Object with acceleration equation/script?

Procedural mesh generation and plotting trajectories

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 andy_the_baker · Feb 17, 2010 at 06:12 AM 0
Share

thanks for these links.

avatar image
1

Answer by Jaap Kreijkamp · Feb 08, 2010 at 05:26 AM

The third parameter of Slerp is clamped between 0 and 1 (so it will never exceed these values). So in your case you would probably use something like:

transform.position = Vector3.Slerp(riseRelCenter, setRelCenter, (Time.time - startTime) / duration);

Where startTime is a variable that contains the time you begin the arcmovement (so set this to Time.time when the player starts this move and duration must hold the total time it should take to make the 'jump'.

Hope this helps... :-)

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 andy_the_baker · Feb 17, 2010 at 06:14 AM 0
Share

you know what the problem was? i was declaring and reassigning the variables constantly. it was arcing but at the end it was slow because it was slerping between smaller and smaller positions. taking the start/end out of the loop was the solution. thanks for your help in understanding the ti$$anonymous$$g. it was helpful.

avatar image sandeepsmartest · Apr 29, 2015 at 10:16 AM 0
Share

Yeah i know its pretty old post but may be for people who are looking for this kind of mechanics , This $$anonymous$$ay Helps

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

How you change another script value smoothly on trigger 0 Answers

Moving the player toward a direction 1 Answer

Move object in an arc 3 Answers

Player carries all boxes instead of one when lifting a box 0 Answers

I'm not using Lerp properly 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