Can't seem to figure out bounce
Lil Washcloth
Member, PRO Posts: 4
Hey, I have looked at around 7 different discussions all asking the same question, how can you get an actor to realistically bounce/ricochet off of walls? Most don't get an answer or the ones with answers have attached files that no longer exist. Hopefully someone can help because a simple collide behavior causes my projectile to infinitely spin in circles upon collision. I am trying to get a projectile to ricochet off a wall upon collision.
Comments
so it bounces, and starts spinning, but you don’t want it to spin?
essentially what happens is, when it collides with the wall, it begins to spin against the wall in a circle
so you’ve set the bounce on the walls and the actors, made sure the moveable actor isn’t on a non scrollable layer, checked the actors motion before and after collision?
it’s hard to tell just from your description and not seeing it or the logic, so i’m just spit balling possibles to check.
I'll throw a couple things against the wall and see if they stick as well. Have you tried checking Fixed Rotation under Physics for the bouncing actor? Also in whatever Behavior you are using to movie it, try choosing Relative to Scene, instead of Actor. Just a couple thoughts...
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I tried both of those, by making the rotation fixed, it no longer spins, however, it shakes against the wall, like it bounces back, then slams right back into the wall, and keeps doing that (and I said shakes because it's going at 900 speed, so it does that process so fast as if it were shaking)
Sorry, I am still relatively new by the way. But I tried unchecking the scrollable on the layers, however that didn't make a difference as to what is going on.
hopefully this screenshot can help, let me know if you need to see anything else.
what behaviour are you using to give the object its motion?
edit: looking at your screenshot, maybe try using changing x and y velocity instead of move.
I've attached a sample project that might help. This isn't perfect as you'd probably want to check and make sure the ball doesn't get stuck in a perfect horizontal or vertical bounce but it should hopefully give you enough information to get going. Check the physics settings closely. The square 'ball' actually has a circular collision shape and Friction has been turned to 0 for both the Wall and Ball actors. You could also experiment with the Bounce settings of each actor depending on what you actual needs are.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@Lil Washcloth -- at a speed of 900 you actor is probably getting stuck inside the wall before it can successfully bounce away. The spinning is just a side effect. This phenomenon is often called "tunneling" and happens a lot in games with very fast moving actors.
One way to fix this "tunneling" problem is to create a rule that tests for collision with the wall and then move the actor back to a playable area.