Report this content
We want the Dreams coMmunity to be a safe, diverse and tolerant place for everyone, no matter their age, gender, race, sexual orientation or otherwise. If you believe this content to contradict these principles, you can file a report for our coMmunity teams to investigate.
Note that misuse of the reporting tool will not be tolerated.Item being reported:
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.