How do I alter the trajectory of a ball's jump depending on the slope of the surface it's on?
I'm making a rolling marble game and would like the jump direction to be slightly different depending on the slope of the surface the ball is currently on. Always up, but a little bit this way or that depending on the slope (and if on a slope the overall height of the jump should be lower as well).
Currently I've got five Laser Scopes on a flat box that moves with the cube (gyroscoped to keep it upright at all times), aimed downwards. I take the Hit Surface Orientation from those and split it, then I add together (separately) the X, Y and Z for all five and divide each by 5.
Finally I recombine the three final XYZ values.
I'm pretty sure this is a good start (if it works like I think/hope it does), because I want to avoid tiny imperfections in the ground sending the ball jumping in a completely unexpected direction. Averaging the output of five Laser Scopes in slightly different positions seems like a good way to do that (more would probably be better, but I can always add more later if I feel like it's necessary.
However I have no idea how to take it further than this.
I'm currently making the ball jump with an Advance Mover by pulsing the Y direction at 5.0 m/s, but that's not going to help when I need to move it in all three axes. Obviously I need to hook all of this up into the three axes somehow, but exactly how is eluding me at the moment.
-
So since you've solved the problem of averaging your surface normal it sounds like this comes down to the problem of how to create a thrust vector based on the angles you've calculated that can be fed to your advanced mover. If that's the case it'd be easy to do with basic trig but we don't have those functions! There are some chips in the dreamiverse for trig functions though I haven't tried them yet.
-
Could you wire the angle into the scene space transform of the mover so you change the angle it’s facing?
Iniciar sesión para dejar un comentario.