Help with Bounce/Springs

Hi guys, im having a right problem with some level springs in my game.

I was originally using bounce physics set to 0.9 which was all well and dandy until i wanted to create a spring wall, i.e player hits spring 1, gets propelled to spring 2 then 3 etc. Problem is when using bounce, it only seems to bounce a random height depending on how high the player was dropped on to the spring in the first place. So when player hits spring 2 the bounce isnt as high and never hits spring 3.

I then decided to try applyForce which works a little better, gives a constant height but gives strange unaturual results i.e if the player hits the bottom of the spring it still gets propelled up, same if the player hits the side.

What is the best way of handling this? really stuck on this one.

Thanks again. [import]uid: 162458 topic_id: 30555 reply_id: 330555[/import]

Try some bodies methods like:

body:applyLinearImpulse
Like applyForce, except that an impulse is a single, momentary jolt.
myBody:applyLinearImpulse( 600, 200, myBody.x, myBody.y )

Try it until any user really helps you. [import]uid: 116842 topic_id: 30555 reply_id: 122407[/import]

thanks but does pretty much the same as applyForce…iv tried using these on the collision with the spring.

myBody:applyForce( 0, -100, myBody.x, myBody.y )
and
myBody:applyLinearImpulse( 0, -2, myBody.x, myBody.y )

iv tried messing around with various values but i cannot for the life of me get the result i want. [import]uid: 162458 topic_id: 30555 reply_id: 122419[/import]

I haven’t done anything like you describe but I think what would do the trick is adding a sensor to the portion of the spring that is the ‘correct’ side. When the player hits that sensor you then handle their movement through one of the applyforce//linearimpulse/setlinearvelocity functions. If they do not hit that sensor then you could just have the default bounce take control and they go off in whatever random direction.

You will probably want the sensor to stick out a little bit and for it to not quite make it to the corners(to avoid someone from hitting the incorrect side + the sensor). [import]uid: 147305 topic_id: 30555 reply_id: 122438[/import]

Try some bodies methods like:

body:applyLinearImpulse
Like applyForce, except that an impulse is a single, momentary jolt.
myBody:applyLinearImpulse( 600, 200, myBody.x, myBody.y )

Try it until any user really helps you. [import]uid: 116842 topic_id: 30555 reply_id: 122407[/import]

thanks but does pretty much the same as applyForce…iv tried using these on the collision with the spring.

myBody:applyForce( 0, -100, myBody.x, myBody.y )
and
myBody:applyLinearImpulse( 0, -2, myBody.x, myBody.y )

iv tried messing around with various values but i cannot for the life of me get the result i want. [import]uid: 162458 topic_id: 30555 reply_id: 122419[/import]

I haven’t done anything like you describe but I think what would do the trick is adding a sensor to the portion of the spring that is the ‘correct’ side. When the player hits that sensor you then handle their movement through one of the applyforce//linearimpulse/setlinearvelocity functions. If they do not hit that sensor then you could just have the default bounce take control and they go off in whatever random direction.

You will probably want the sensor to stick out a little bit and for it to not quite make it to the corners(to avoid someone from hitting the incorrect side + the sensor). [import]uid: 147305 topic_id: 30555 reply_id: 122438[/import]