How can I change speed of actor without changing direction?

Dell7730Dell7730 Member, PRO Posts: 388

My ball actor is launched with Accelerate Toward behavior at -3500 acceleration, how can I slow it down without making any change to direction? just let it fly off but with decreasing speed.

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    @Dell7730 said:
    i have it -3500 to start fast and i want it to slow down gradually by any speed.. i'll give your suggestion a try and let you know what happens

    If you want the actor to start fast then Accelerate is probably the wrong choice as Accelerate, by definition, starts slowly and increases in speed.

    As for slowing an actor down there are lots of ways to do this, if you were using a Move behaviour you could interpolate the speed down, or if you want to stick with Accelerate then you could simply increase the drag over time.

Answers

  • tintrantintran Member Posts: 453

    If you want to slow it down, can't you just make the Accelerate Toward behavior at -1000 instead of -3500. The only other way i can think of is changing both self.motion.linearVelocity.x and self.motion.linearVelocity.y by the same factor.
    like if actor is clicked on or something divide both velocities by a same factor/number

  • Dell7730Dell7730 Member, PRO Posts: 388

    @tintran said:
    If you want to slow it down, can't you just make the Accelerate Toward behavior at -1000 instead of -3500. The only other way i can think of is changing both self.motion.linearVelocity.x and self.motion.linearVelocity.y by the same factor.
    like if actor is clicked on or something divide both velocities by a same factor/number

    i have it -3500 to start fast and i want it to slow down gradually by any speed.. i'll give your suggestion a try and let you know what happens

  • Dell7730Dell7730 Member, PRO Posts: 388

    @Socks said:
    As for slowing an actor down there are lots of ways to do this, if you were using a Move behaviour you could interpolate the speed down, or if you want to stick with Accelerate then you could simply increase the drag over time.

    hmmmm, still can't believe i'm seeing a lot of letters, not just letters but words, not just words but sentences and not just dots like ..... hahaha

    But joking aside, i'll give your suggestion a try, you know I will lol

  • Dell7730Dell7730 Member, PRO Posts: 388

    @Socks said:
    As for slowing an actor down there are lots of ways to do this, if you were using a Move behaviour you could interpolate the speed down, or if you want to stick with Accelerate then you could simply increase the drag over time.

    I tried the move behavior, both of them, problem with those is once the time limit is done, and gravity pulls the ball, it comes down straight, no arch like a natural ball would.

  • SocksSocks London, UK.Member Posts: 12,822

    @Dell7730 said:
    I tried the move behavior, both of them, problem with those is once the time limit is done, and gravity pulls the ball, it comes down straight, no arch like a natural ball would.

    Time limit ? Gravity ?

  • Dell7730Dell7730 Member, PRO Posts: 388

    yes, with time limit, and gravity... oh! are you asking what's the time limit and amount of gravity?

  • Dell7730Dell7730 Member, PRO Posts: 388

    @Socks said:
    As for slowing an actor down there are lots of ways to do this, if you were using a Move behaviour you could interpolate the speed down, or if you want to stick with Accelerate then you could simply increase the drag over time.

    Finally got it, copied the formula used in Angry Birds without the powerups and so on, using Change Velocity and vectorToAngle. @Socks thanks again.

  • Dell7730Dell7730 Member, PRO Posts: 388

    @Socks

    Here's the gameplay demo of the game I'm about to publish...

  • SocksSocks London, UK.Member Posts: 12,822

    @Dell7730 said:
    Socks

    Here's the gameplay demo of the game I'm about to publish...

    Looks very polished ! :)

  • Dell7730Dell7730 Member, PRO Posts: 388

    @Socks said:
    Looks very polished ! :)

    I like it polished lol

Sign In or Register to comment.