speeding up actor on collision

Village IdiotVillage Idiot Member, PRO Posts: 486

So I've got a ball that I want to speed up (whilst travelling in the same direction) – when it collides with another actor. I've tried various things but can't make it work. This seems simple enough, alas, I am even more simple. Can anyone please help me here?

Comments

  • IceboxIcebox Member Posts: 1,485

    if actor ball overlaps or collides with other actor
    change attribute self.motion linear velocity x to self.motion linear velocity x + 10 or any value you want

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

    @monkeyboy simian said:
    So I've got a ball that I want to speed up (whilst travelling in the same direction) – when it collides with another actor.

    Is the actor travelling in just one axis (horizontal or vertical), or is it traveling at some arbitrary angle ?

  • ToqueToque Member Posts: 1,188

    @Icebox said:
    if actor ball overlaps or collides with other actor
    change attribute self.motion linear velocity x to self.motion linear velocity x + 10 or any value you want

    That will work if travelling in a positive x velocity. You could do the same with Y positive velocity as well.

  • Village IdiotVillage Idiot Member, PRO Posts: 486
    edited April 2017

    The actor that's travelling is a ball and it travels along both x and y – because it's travelling in whichever direction the player chooses to propel it. Metinx that means arbitrary @Socks.

    I've already tried what you suggested @Toque – and it didn't work.. unless I got it wrong.. I'll take a closer look just to be sure. I think the fact that it's travelling along x and y and is being propelled by the player could complicate things.

    I'm using vectorToAngle. I've got this sort of sling shot action happening to propel the ball..

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2017

    @monkeyboy simian said:
    The actor that's travelling is a ball and it travels along both x and y . . .

    Then you will need to express the increase in speed as a percentage of the current X and the current Y speed, this will maintain the relationship between the two (to maintain the angle), so it should look something like this . . . .

    Change Velocity X to Velocity X * 1.5
    Change Velocity Y to Velocity Y * 1.5

    . . . . which will increase the actor's speed to 150% of the current speed.

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

    Demo file attached:

  • Village IdiotVillage Idiot Member, PRO Posts: 486

    Right on the money @Socks! Thanks heaps for that! Interestingly it's starting to make sense to me.. Watching your demo is strangely hypnotic..

Sign In or Register to comment.