Monday, September 5, 2022
HomeGame DevelopmentBezierTo doesn't transfer at fixed velocity - cocos2d-x

BezierTo doesn’t transfer at fixed velocity – cocos2d-x


Utilizing BezierTo on a Sprite I observe that it strikes at completely different speeds at completely different locations on the curve. Any options for this?

I’ve a path made up of curves, for every curve I calculate the size after which use that size to calculate the time. Nonetheless it’s on a person curve outlined in BezierTo that the sprite slows down and accelerates.

I’ve demoed this within the video beneath setting the curve as a straight line. You do that by setting management level 1 to the tip and management level 2 to the start with a time of two seconds. The sprite will get slower the nearer to the center it will get till virtually stops. Settings the factors to be equally distanced alongside the road solves this for Bezier straight strains, however I’m not utilizing Bezier curves for strains, this similar behaviour is exhibited on curves and that is problematic.

Instance of not fixed velocity on a curve. A bit laborious to see however the sprite picks up a little bit of velocity when hitting the curve within the centre of the display screen.


That is the ensuing behaviour of Bezier curve maths for getting the X and Y factors at a proportion of the entire curve, 0% being the beginning level and 100% being the tip level of the curve and all different percentages being the factors in between. Cocos2d works by getting the present X and Y with the proportion being the time handed since beginning the transfer and the whole time your entire transfer will take. So 5 seconds into a ten second transfer will get the purpose at 50%.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments