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 RenaudCharles · Nov 16, 2012 at 10:15 PM · 2dmovementvelocitysmooth

Complex 2D movement (X,Y) using velocity.

I have an entity in my scene that can only move in 2D space (sidescrolling) and its velocity can be affected by multiple triggers (push, pull, etc.). I've been trying to implement a movement system that allows for loops and twists and turns in a 2d space using velocity only but with no good results.

So far I've been applying a certain velocity based on maths every frame or so for X time (the time of the movement) but there's been 2 major problems:

  1. It doesn't react well with the triggers (that pushes and pull) because my function Sets a velocity and doesn't modify the actual one with a new trajectory.

  2. Its not smooth, every X time I can see the ball clearly changing trajectory which makes for an unrealistic and annoying experience.

Here's an image of what I'm trying to achieve:

alt text

Many thanks to anyone who tries to help.

Comment
Add comment · Show 3
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 FakeBerenger · Nov 16, 2012 at 11:27 PM 0
Share

You're not using physic stuff right ? You're updating the position in Update according to your var velocity ?

avatar image kromenak · Nov 17, 2012 at 12:51 AM 0
Share

I'm not sure how you are representing your movement speed and direction, but assu$$anonymous$$g that you have a float movement speed and a vector representing the move direction, you might be able to get something like this by having your triggers set a target direction for the object, and then have the object rotate towards the target direction bit-by-bit over a number of frames. It will then appear as though the object is turning slowly in the direction he should go ins$$anonymous$$d of taking a sharp turn. Is that the problem you are having?

avatar image RenaudCharles · Nov 20, 2012 at 03:36 AM 0
Share

@$$anonymous$$romenak, I'll give your idea a try. I've also been thinking of using normalized vectors with sin and cos on the X and Y.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Nov 20, 2012 at 04:34 AM

there are kind of 2 ways to do this.

The easiest is probably to take the center point of the loop circle and rotate towards that constantly at a speed that is slower than the speed at which the object is traveling.

when its looking towards the right of the screen and the center is above it it will start rotating up. Now because its moving towards whatever side of the box is forward the front of the object will start rotating toward up so it will start arcing its way up. By the time it is facing straight up though the center of the circle will now be left of it and the process starts anew.

Get the speed right and the object will arc in a circle.

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

12 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

Related Questions

How can I make 2D movement less jerky on a controller, with velocity and such? 0 Answers

Change in position going up not smooth 1 Answer

How do I make an Enemy charge through a point? 1 Answer

Smooth movement using Rigidbody2d 3 Answers

Smooth Character Movement 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