Jump to content
  • Advertisement
Sign in to follow this  
Carlyle

Draw Lines [Help]

This topic is 2340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Guys,
I want to connect 2 models with lines and make them behave like in this video game:

How do i do that ?
I realy don´t know where to start.

Share this post


Link to post
Share on other sites
Advertisement
Never played the game, but behavior can be pretty specifically made for certain scenarios. Drawing the lines is not really that hard though. An entities' position is basically represented with a vector (x, y, z position in space) and you can simply draw a line between the 2 positions.

As for the behavior itself, I don't really know what you want to do, but if you for example want the characters to not be able to move a certain distance from each other, you can simply do (position1 - position2) and check for the distance.

I think it would be wise to look into vector and matrix math and you will figure certain things out you might want to do.

Share this post


Link to post
Share on other sites
The main problem ist, that i want the lines to move like the ones floating in the video when a character moves.

Share this post


Link to post
Share on other sites
if you mean the lines around Gaara, you might try and use bezier curves:http://en.wikipedia.org/wiki/B%C3%A9zier_curve. They provide you pretty much the same effect.

move the *control points* of the bezier curve around a bit using a periodic function such as sin() or cos() ( because the values of sin and cos range from -1 to 1, the lines will move both up and down). Try that and check if it works. You might be in for some heavy tweaking though :)

Share this post


Link to post
Share on other sites
Hidden
Ah right, I misread and thought you want the behavior of the characters. My bad!

Yeah you should go with what bollu

says, probably the best way to go.

Share this post


Link to post
Looks like maybe a string simulator, although somewhat tricky since the "target length" of the string is constantly changing to keep it pulled fairly tight between the two characters, but loose enough to boing up and down nicely. I think it should work just fine, to change the stretch constant for a string every frame (not so constant now, are you? laugh.png)

Check out this site, for a simple way to do string simulation http://freespace.vir...ls/m_string.htm
I wrote a little demo for gameboy advance based on that article a long time ago, which can be found here:
http://deku.rydia.ne...ram/sproing.zip
http://deku.rydia.ne...oing-source.zip

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!