Bounce off walls

sor3ns3nsor3ns3n Member, PRO Posts: 28

Hi, I am new to Game salad, just wondering how to set up a ball to bounce off a wall and continue going in the exact same direction?

so if a ball hits a wall at 45degrees, it then bounces off the wall at the same angle
I want a ball to continuously bounce off the walls

Any help would be greatly appreciated
Thanks

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Like this? The attached demo uses the built in physics engine to handle the bouncing.

  • MelodyCatsMelodyCats Member, PRO Posts: 128

    @jamie_c demo looks good - you could maybe also add a rotate behavior to the ball so it never gets stuck in one place...

  • sor3ns3nsor3ns3n Member, PRO Posts: 28

    Ye thats what i am looking for! Your square starts off well but then ends up in 1 place haha, i just want continuous bounce

    @MusicBoutique where abouts do i add the rotate behaviour?
    is it in the rule section to the square
    or is it in its characteristics?

  • MelodyCatsMelodyCats Member, PRO Posts: 128

    Just click on the ball and drag 'rotate' from the behaviors column into it. then set it for example to 400.

  • sor3ns3nsor3ns3n Member, PRO Posts: 28

    Still struggling, I have added the rotate function but it still seems to end up in one positions. It starts off going at say 45 degrees, bounces a few times, and then ends up bouncing completely vertical :( up down up down.

  • MelodyCatsMelodyCats Member, PRO Posts: 128

    attaching modified @jamie_c demo ... seems to keep moving for me. The only thing is it gradually loses speed - maybe someone else will have an idea of how to keep velocity contant.

  • ToqueToque Member Posts: 1,188

    Maybe you could play with this. Should keep going at same speed.

    https://www.dropbox.com/sh/e82tpis072iwoyg/AADT5ZlFeaZSsYuBaeNjVYaOa?dl=0

  • IceboxIcebox Member Posts: 1,485

    This is something I want to know as well , I cant find a nice way to do it without rotating :) I wonder how its done

  • ToqueToque Member Posts: 1,188
    edited November 2016

    Rule. If touch walls change attribute velocity x = -1* velocity x
    change attribute velocity Y=-1*velocity Y

    Change frictions in actors to 0.

    No rotation is needed but its pretty boring bouncing.

    Not sure this is what your asking @Icebox??

  • IceboxIcebox Member Posts: 1,485

    @Toque No i meant the same effect you have in your demo but without rotating the actor , if i multiply the velocity by -1 it will just bounce back and forth , i meant bounce off all walls with a constant speed without rotating :D dont know if i made sense :)

  • ToqueToque Member Posts: 1,188
    edited November 2016

    https://www.dropbox.com/sh/e82tpis072iwoyg/AADT5ZlFeaZSsYuBaeNjVYaOa?dl=0

    No rotation....?

    Haha hard to explain things we can't do eh??? :}

  • IceboxIcebox Member Posts: 1,485
    edited November 2016

    Edit:deleted this comment

  • IceboxIcebox Member Posts: 1,485
    edited November 2016

    @Toque Oh i just saw it , yes exactly :) thanks , i made it way too complicated :D

  • ToqueToque Member Posts: 1,188

    @Icebox said:
    @Toque Oh i just saw it , yes exactly :) thanks , i made it way too complicated :D

    Usually I try wrong way first then over complicated way, then the google way, then ask. :smile: A mentor showed this method so I owe him all credit.

  • IceboxIcebox Member Posts: 1,485

    @Toque Yes, I was confused cause its just like jamie's demo , but his gets stuck at one place and yours continue to bounce off , so setting the friction to 0 does the trick , didnt know that :) cheers !

Sign In or Register to comment.