Closed pyNuts closed 7 years ago
I think I've found a solution.
If I add both forces in the update function to a For Loop, with a range of the number of forces, it will run through both before applying them, so far it seems to be working and not loosing any velocity.
Still, can anyone explain why it needed that in the first place?
Well it worked for one example but now doesn't must be a bug.
There is an error in your algorithm. Is this homework, or just for fun?
Hi, its just fun, im kind of new to classes but have tried many ways and the ball keeps bleeding energy with each bounce, Ive tried the whole thing when location.y goes below height to set it as height before reversing velocity hoping that would help but no luck, any recommendations?
I did manage to fix the ball going off screen issue though with location.y = height but its the magnitude of the bounce that is losing energy, Ive read multiple sources but nothing has worked.
I believe the issues you're having are not a bug in Python Mode for Processing, so I'm closing the bug. Give the Processing forums a try for help with the bounce algorithm.
For some reason using a PVector to make a ball bounce up and down always loses height over time and messes up after a few bounces, im not sure if its a fault with the python mode because its a pretty simple code.
Heres a simple example of what i mean, im new to classes but im pretty sure its not the code.
class Bounce: global location, velocity, acceleration
def setup(): global b size(600,600) b = Bounce()
def draw(): background(255) b.update() b.edge() b.display()