Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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 GenericToast · Sep 24, 2017 at 09:17 AM · movinginterpolationmovementslerpingeasing

Moving gameobjects with easing

Im trying to make move commands similar to the one in the game 'Geometry Dash' When a move command is activated, a target object is moved a certain distance in the x and y axis within a specific time(seconds). Easing can also be applied to control the acceleration/deceleration of the object while it is moving.

alt text Move commands need to be able to stack with each other

I have a MoveCommand class that calculates the current displacement every fixed update for each move command.

An example of the calculation i am currently using in the MoveCommand class:

 //The 'time' variable is between 0.0f to 1.0f

 //this is just an example to show different easings
 displacementX = time * moveDistancXe; //for linear easing
 displacementY = (time * time) * moveDistanceY; //for quadratic in easing

 targetObject.transform.position = new Vector3(displacementX, displacementY, 0.0f);

How do i go about taking all these MoveCommand(s) and applying the displacement to the target object, since there can be multiple MoveCommands affecting the same object? Or is there another much way to this?

tldr - I need a way to move objects when a command is given(i know how to do the easing part). I have no problems when working with a single command, but there can be multiple commands affecting the same object at once, resulting in each one of them overriding the other.

snip1.png (151.2 kB)
Comment
Add comment · Show 2
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 frankslater · Sep 24, 2017 at 10:14 AM 0
Share

I'm afraid not a lot of us will understand what exactly you are trying to do here and where you are stuck. I myself never played Geometry Dash. We will need more specifics and probably a good idea to post the scripts you have the problem with. Posting pictures can help a lot, so kudos on that.

One thing I can tell you is that you probably don't want to calculate any sort of displacement every frame. You want to do that in FixedUpdate.

avatar image GenericToast frankslater · Sep 24, 2017 at 10:16 AM 0
Share

Thanks for the advice, i'll try to explain my question clearer

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TheMannyzaur · Sep 24, 2017 at 02:59 PM

Vector2.Lerp can be used for easing. try looking it up on Scripting Ref

Comment
Add comment · Show 3 · 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 GenericToast · Sep 24, 2017 at 03:02 PM 0
Share

I know how to do the easing parts, what i don't know is how to apply multiple easings that stack with each other to the same gameobject

avatar image TheMannyzaur · Sep 24, 2017 at 03:26 PM 0
Share

@GenericToast can you explain further because I havent played Geometry Dash

avatar image GenericToast TheMannyzaur · Sep 24, 2017 at 03:45 PM 0
Share

Each $$anonymous$$oveCommand calculates a displacement using an easing formula. I want to take these displacements from multiple $$anonymous$$oveCommands, and apply it to the position of a single gameobject

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

71 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Apply multiple Lerps to the game value 1 Answer

Play Animation and Stop Moving on Enemy Collision 1 Answer

How to scale a object after moving the same gameobject? 1 Answer

How to make a object move right automatically in 2d. 2 Answers

Interpolating the motion of a camera moving from one node to another 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