Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 3    [LBP3] Help!!
#1

Momentum

Archive: 7 posts


This might be just a curiosity, but a buddy of mine is making a 3D rolling ball level. He made In/out momentum for the ball with forward back timers. It is fairly standard. It works but, it doesn't work accurately with speed changes like a boost or jumping.

I made a 2D map of the ball and made it move, or roll, left / right instead of in/out. This way no matter what the speed, the ball reacts to friction and new controller inputs with game physics and translates them into the in/out momentum we want and matches the left/right momentum perfectly.

The problem is the map isn't perfect because of, well, players. If an obstacle is hit and the player continues to press that direction the map ball will slide and could potentially reach the end of the map. I made logic to prevent this but it makes new problems...

What I want is a 100% logic system. My idea was to take in/out speed and store it in a feedback loop. This gives me momentum. Now I need variable counteracting forces like gravity, friction and directional inputs to wind the feedback loop back to 0. This obviously has to work for negative and positive inputs and stop at 0.

So my problem is twofold. Getting the feedback loop to stop at 0 and getting accurate resistance that realistically matches the left/right game physics.

What would work great would be a variable speed timer set to start count down, but I don't think that exists.
Or if someone has already built a system, I would like to see how they did it.

Any thoughts?
2015-08-17 22:23:00

Author:
one-mad-bunny
Posts: 334


Well, gravity works by relative speed in real life right? It slows down to an apex of a parabola, and comes back down the same way. Thinking about it this way, you could model a feedback loop on the change of speed, without paying attention to anything else. All you would need are detectors for impacts that slow the ascension and descension. EG ball is moving up at 5u/s (units), then it slows down by a square factor of some applied number (I'm not adept in physics), slows down from 5 to some number (I'm making up these numbers, as to not give the wrong idea; I don't know physics), 5 to 1, then to .2, then .04 etc. Then in reverse on it's way down.

I would do this by calculating the change in speeds, and focusing what can influence those changes and applying to them changes in the feedback loop, rather than trying to map out all speeds from scratch; modify the upwards acceleration to be accurate to gravity
2015-08-17 22:58:00

Author:
amiel445566
Posts: 664


I like the thinking!

So if I understand, I could divide my speed by a factor (gravity), and that would give the variable timer effect I'm after. Then I could increase or decrease the factor to simulate friction...

I'll have to experiment with this, especially the speed of operations.
2015-08-17 23:51:00

Author:
one-mad-bunny
Posts: 334


Gravity works by a constant downward acceleration acting on the object. At time 0, the velocity of an object moving upward is whatever you make it, and thereafter the y component of the object velocity is accelerating downward at a constant rate, meaning that the y velocity will decline until it reaches 0 at the vertex of the parabola, and will go negative, meaning motion proceeds in the opposite direction. The x component is independent of the y component of velocity, so speed left and right has no bearing on up and down. I use this model in top down jump logic with an advanced in out mover, I basically just choose an acceleration of gravity. Thats the physics of it, assuming Newtonian conditions (you don't want air resistance in there).2015-08-19 01:47:00

Author:
Tynz21
Posts: 544


Thanks guys!

I got this working fairly well. I was making it more complicated than it needed to be at first. After reading and rereading your posts I finally had a vision of two arrows pointing at each other. One arrow representing the force that makes the object move and the other is resistance. Resistance is a constant force that needs to be overcome to achieve movement. And once movement is achieved and force is no longer added the constant resistance slows it down.

Oh, and getting everything to stop at 0. Easy. I had to make a separate feedback loop for "in" movement and one for "out", then I just dumped the signals past 0 with splitters.

Thanks again!
2015-08-20 12:05:00

Author:
one-mad-bunny
Posts: 334


Thanks guys!

I got this working fairly well. I was making it more complicated than it needed to be at first. After reading and rereading your posts I finally had a vision of two arrows pointing at each other. One arrow representing the force that makes the object move and the other is resistance. Resistance is a constant force that needs to be overcome to achieve movement. And once movement is achieved and force is no longer added the constant resistance slows it down.

Oh, and getting everything to stop at 0. Easy. I had to make a separate feedback loop for "in" movement and one for "out", then I just dumped the signals past 0 with splitters.

Thanks again!

still too complicated.....

split the output of an in/out speed sensor, subtract "resistance per frame" from both outputs of the splitter using 2 combiners, split both of those outputs, then take both positive outputs of those 2 splitters and wire them into a combiner, add "controller input per frame" to this combiners output using an adding OR gate. then wire the OR directly to your in/out mover.
just make sure both the speed sensor and mover are set to the same speed, and you may need to swap negative and positive by inverting the last combiner (not sure)
this way the sensor and mover become the feedback loop.

i do the same thing for top down gravity (as i think tynz21 was getting at, though in some other language )
i basically just subtract "gravity per frame" from current in/out speed, and pulse "jump speed per frame" for one frame for jump. leads to a very smooth jumping arc
2015-08-20 13:28:00

Author:
evret
Posts: 612


still too complicated.....

split the output of an in/out speed sensor, subtract "resistance per frame" from both outputs of the splitter using 2 combiners, split both of those outputs, then take both positive outputs of those 2 splitters and wire them into a combiner, add "controller input per frame" to this combiners output using an adding OR gate. then wire the OR directly to your in/out mover.
just make sure both the speed sensor and mover are set to the same speed, and you may need to swap negative and positive by inverting the last combiner (not sure)
this way the sensor and mover become the feedback loop.

i do the same thing for top down gravity (as i think tynz21 was getting at, though in some other language )
i basically just subtract "gravity per frame" from current in/out speed, and pulse "jump speed per frame" for one frame for jump. leads to a very smooth jumping arc


If I were dealing with one speed your way is certainly less complicated. The thing I like about your version is how smooth the movement is. So I adapted it. I removed my feedback loops and came up with this. It is a rolling ball. The other logic chips are for air steering while jumping, gravity for ramps, and a most recent direction recorder for the boost. http://i7.lbp.me/img/ft/be763e51b079563dd9b083d7f9efdf3245d8e2e3.jpg

Thanks again guys! This works really well, and is easy to customize for other applications, like 3D ice for platforming or throwing objects in 3D. If you see anything I can optimize or just have general suggestions I would be happy to hear them.
2015-08-22 19:59:00

Author:
one-mad-bunny
Posts: 334


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.