2
\$\begingroup\$

I'm interested in maps/environments which are flexible and change at runtime, such as those in Contre Jour.

I have looked for a long time to find out how to make this effect, but I couldn't find an answer. The closest I found was maybe something like this using springs to deform meshes.

Are there better methods for implementing this feature?

\$\endgroup\$
  • 1
    \$\begingroup\$ Maybe help us out with some code that you have already created, tell us how you do your terrain at the moment, have you started with terrain already? Have you attempted what you're trying to achieve? If so then let us see so we can help further your question with better answers! \$\endgroup\$ – Tom 'Blue' Piddock Jan 23 '14 at 17:01
1
\$\begingroup\$

It looks like it is probably based on curves - like maybe piecewise Bezier curves, or maybe B-splines.

Internally in the code they could also be using hermite splines, catmul-rom splines or some other variant but without seeing the code its nearly impossible to tell what specific curve is being used since many of the above are visually equivalent, but are calculated differently!

Anyways, curves are a deep topic, but here's a nice basic introduction to Bezier curves: http://blog.demofox.org/2014/03/04/bezier-curves/

\$\endgroup\$
0
\$\begingroup\$

I do not know how it is done there nor can you ask that specifically unless you contact the creator of that demo. What you can do is use a static body for the floor in it's present (current) state. Then use something similar to the bridge demo here (tap arrow key to the right -> three times): http://www.jangaroo.net/files/examples/flash/box2d/

When you release the bridge here you'll need to create a static surface where the bridge was. Also, you may need to create the flexible bridge with the correct constraints when the user clicks the mouse.

One last thing is that it appears the surface is being pulled from multiple points. Not just the one where the user clicks but also a couple if nearby ones.

\$\endgroup\$
0
\$\begingroup\$

One approach is to take the coordinates of the users click in game world and interpolate the points on either side to alter the terrain. The result are going to be determined by your method of interpolation. For instance a linear interpolation will result in triangle forming.

https://en.wikipedia.org/wiki/Interpolation

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.