Trampoline: The Final Frontier

Sep 7, 2009 at 4:57 PM
Edited Sep 7, 2009 at 5:00 PM

I've been working on creating various physics scenarios seeing if a game can come out of them.  Anything with joints seems to just come out dandy, when I throw springs into the mix I have a more difficult time design.

My first iand favorite idea involves multijointed objects bouncing on a trampoline.  I'm just having a really hard time making this work out.  The trampoline will eventually move around.  At this point I have a large rectangular body, and a polygon body with a slight curve bound by three linearanglejoints.  I can create a bouncy like effect (especially by cheating by adding a restitutioncoefficient), but when the trampoline moves, the canvas has a very difficult time returning to center (it just circles around the center point a lot). 

Below is my code, any experiences or advice folks can offer would be appreciated.



spring = SpringFactory.Instance.CreateLinearSpring(GameManager.Current.Simulator, trampBase.ObjectBody,new Vector2(-650, 0), trampCanvas.ObjectBody, new Vector2(-600, 0), 1500, 100);
//spring.RestLength = 1;

spring = SpringFactory.Instance.CreateLinearSpring(GameManager.Current.Simulator, trampBase.ObjectBody,new Vector2(0, 0), trampCanvas.ObjectBody, new Vector2(0, 0), 500, 250);
//spring.RestLength = 0;

spring = SpringFactory.Instance.CreateLinearSpring(GameManager.Current.Simulator, trampBase.ObjectBody,new Vector2(650, 0), trampCanvas.ObjectBody, new Vector2(600, 0), 1500, 100);
//spring.RestLength = 1;


Sep 7, 2009 at 5:41 PM

you could try turning up the iterations (physicsSimulator.Iterations) and that would make the springs more apt to return to their initials state quickly. tho if you just want a bouncy platform, you could just manually set the X position every frame. that way it would just bounce vertically and it'd probably be a bit more stable.

Sep 7, 2009 at 5:45 PM

I never thought about the interations, but the trampoline will rotate and such, so the X solution won't apply.

Sep 7, 2009 at 5:47 PM

well i would imagine you'd want some rotation there, but otherwise you could also set the rotation manually. if you're using xna you could also clamp it