I'm making a space type game, sort of Lunar Lander/Jetpack/Thrust sort of feel.
I'm going to have the ship fly inside a cavern for instance and it will take damage if it hits a surface too hard - none of this part is a problem.
However, as I'm using custom movement, I can't work out how to get the ship to bounce off at a shallow angle when colliding. I thought about using the platform behavior but I couldn't get it working for flight as I wanted. I can get it to reverse direction to keep it out of the solid but it goes directly backwards and I want something more like skipping a stone on water.
The inverse angle of impact would be ideal but it needs to work on vertical surfaces, or whatever the particular piece of ground may be angle at.
Hi, just ran across an answer that worked from jangsy5. In my case, I had to add 180 to the result, but then it worked for me.
((2 * wall.Angle) - Player.CustomMovement.MovingAngle) + 180
My ship is "Player" and the wall object is "Wall". Originality at its finest. When the player collides with the wall, it calls the Custom Movement behavior, to set the angle of motion to the formula above.
Develop games in your browser. Powerful, performant & highly capable.
Thanks MobWthPitchforks, yes I bet that would have worked for me.
In the end though, I had a somewhat workable system with custom movement but I wanted to add some physics as well.
I found that mixed together they just don't work for collisions etc, I'd need to do a complete custom movement collision system and another complete physics one so I switched to just using physics instead and played with that until I got similar flight characteristics.