Constant acceleration between two walls ... Interpolate?
I have tried two days of variations but I can't get this to work. Help!!!
I need the actor to accelerate and when it hits a wall I want it to continue to accelerate at the same rate in the opposite direction.
So say it starts accelerating at a rate of 10, I want it to continue to accelerate at 10 after it hits the wall but in the oposite direction. If I use bounce the actor will decelerate. If I change the restitution it decelerates then accelerates - nothing is constant.
I'm probably missing something very basic :-(
I need this to finish my game so any help most appreciated.
I need the actor to accelerate and when it hits a wall I want it to continue to accelerate at the same rate in the opposite direction.
So say it starts accelerating at a rate of 10, I want it to continue to accelerate at 10 after it hits the wall but in the oposite direction. If I use bounce the actor will decelerate. If I change the restitution it decelerates then accelerates - nothing is constant.
I'm probably missing something very basic :-(
I need this to finish my game so any help most appreciated.
Comments
see how that works for ya
There's no way to use the acceleration behavior?
The other way will probably be alot smoother, try it out and see what you like though
I must be missing something. My accelerating object does not seem to detect the wall. I opened a completely new project as a test with two actors, puck and wall.
On the puck I have a rule:
Actor receives event -overlaps or collides with - wall
Accelerate speed 10 direction 180
Otherwise
Accelerate speed 10 direction 0
Wall is not movable, restitution 0
However, if I use Change Velocity behaviors instead of Accelerate the puck will detect the wall. Is this a bug?
BTW, I would prefer to use the accelerate behavior because my actors currently use it and I do not seem to be able to make the velocity increment easily.
EDIT: You don't think it can be done with the Acceleration behavior?
Do you know a way to make the actor accelerate smoothly between the walls?
I've tried the following:
1. Accelerate behavior and Collide behavior -> bounce speed is not controllable
2. Accelerate behavior and Collide Rule -> does not recognize collision
3. Increment velocity when each wall hit -> works ok but does not give acceleration in between walls, giving jumps in speed that don't seem smooth.
So now I am thinking that interpolate may work, but I can't seem to make it bounce between the walls. I can get it to go left to right, but not the right to left.
Any and all ideas most appreciated.
Yours: 200 change direction 210 change direction 220 change direction 230
Mine: 200, 200.1, 200.2, 200.3 -> 210 change direction 210.01, 210,02....220 change direction