I've been working on a stack that moves a round grc around the screen based on the accelerometer. I have code that keeps it within the bounds of the screen, code that makes it "bounce" a little based on velocity, as well as a little friction so that its actually possible to stop the ball in place.
All of the above is working well.
My problem is that I want to turn this into a marble maze game and i'm having difficulty dealing with the walls. I've got it to where the walls are maneagable in 2 directions (for example, top and bottom, check for intersect, check direction of movement and then set the ball to the proper location (a y value) and adjust the velocity(for the bounce affect, reverse direction and multiply the velocity by a factor to slow it way down)
The thing I can't seem to wrap my head around is a way to roll the ball around a corner. Obviously this will require a full rethink. Currently as it tries to pass the corner an intersect occurs and it pops to the top or the bottom which is not the desired affect.
Can anyone point me to a better algorithm? Give any pointers at all?
Thanks in advance for any and all help!
Accelerometer moving a grc
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Accelerometer moving a grc
See if the animationEngine will help you out (all the hard work has been done for you).. There is a demo version you can play with to see if it will help you out.. Of course, if the whole objective of this project is to do all the math and whatnot by yourself, ignore this post 

Re: Accelerometer moving a grc
Understanding the math would be cool and i'm definitely in "think about it all" mode but have taken your suggestion and am experimenting with AE now too! Its pretty amazing, and hopefully i'll be able to get something working one way or another!
Re: Accelerometer moving a grc
Hi Mike,
have a look at the stacks from Jim Hurley on RevOnline, especially "Two Ball Collisions", "Kaleidoscope" and "SimpleMotion".
There is a lot of math in there that could be of interest for your project, especially collision, velocities in "Two Ball Collisions"
and on Jim's website there is "follow the bouncing ball"
copy the following into your message box and hit the return key:
The stack will be loaded into Livecode.
I learned a lot from Jim Hurley's stacks. Not that I understand the math but I use parts of his algorithms.
Kind regards
Bernd
have a look at the stacks from Jim Hurley on RevOnline, especially "Two Ball Collisions", "Kaleidoscope" and "SimpleMotion".
There is a lot of math in there that could be of interest for your project, especially collision, velocities in "Two Ball Collisions"
and on Jim's website there is "follow the bouncing ball"
copy the following into your message box and hit the return key:
Code: Select all
go url "http://home.infostations.net/jhurley/BouncingBallTools.rev"
I learned a lot from Jim Hurley's stacks. Not that I understand the math but I use parts of his algorithms.
Kind regards
Bernd
Re: Accelerometer moving a grc
Thx for the links bernd, I think i'll be able to learn enough from these to do what I need. Thx Jim Hurley too!