Elastic surface symulator
Elastic surface symulator
Hi guys
I was bored so i made this silly program that poorly emulates the plane in 2d space.
I jus started to learn programming from this tut series so my skills are rather on a very poor level
I was planning to use this effect in future projects ( games ).
use the 'left mouse button'
Hope you enjoy it
I was bored so i made this silly program that poorly emulates the plane in 2d space.
I jus started to learn programming from this tut series so my skills are rather on a very poor level
I was planning to use this effect in future projects ( games ).
use the 'left mouse button'
Hope you enjoy it
- Attachments
-
- ElasticPlaneSymulator.zip
- Elastic surface symulator
- (170.66 KiB) Downloaded 360 times
Re: Elastic surface symulator
Nice work! this looks pretty cool.
I wonder if you could use that in some game. Maybe like a magnifying glass for a grid based game.
I wonder if you could use that in some game. Maybe like a magnifying glass for a grid based game.
ʕ •ᴥ•ʔ
Re: Elastic surface symulator
Neat looking effect, I like it and your code is very well written, thumps up
Keep up the good work.
Keep up the good work.
Re: Elastic surface symulator
Thanks for the update I really appreciate it
Even if it looks nice it is not what i was aiming for :/
I made some modyfications to the program and tried to make a mesh of particles that stays in the solid distance from each other, and when they are disturbed they behave like a spring and try to get back to its default state.
I was able to acomplish that task in about 50% rate. That is because when i disturb it it waves unstopably
I dont know much about regulation stuff so
If you guys have any idea how to fix that oscylation i would be mucho obliged ;p
grab the code
Anyway happy new year ;D
Even if it looks nice it is not what i was aiming for :/
I made some modyfications to the program and tried to make a mesh of particles that stays in the solid distance from each other, and when they are disturbed they behave like a spring and try to get back to its default state.
I was able to acomplish that task in about 50% rate. That is because when i disturb it it waves unstopably
I dont know much about regulation stuff so
If you guys have any idea how to fix that oscylation i would be mucho obliged ;p
grab the code
Code: Select all
if ( (l > TABX ) && ( l < TABLENGHT - TABX - 1 ) ) // I MADE SURE THAT PROGRAM WILL NOT
{
if ( l%TABX != 0 && (l)%(TABX) != TABX - 1 ) // INCLUDE BORDER POINTS IN CHECKING STATE
{
par[ l ].gre = 0;
par[ l ].blu = 0;
int crap = 1; // dont know why but if i change amplification this whole block stops working :(
par[l].x = par[l].x + crap*(par[l-1].x - par[l].x + par[l+1].x - par[l].x); // In here I was trying to move only current state point
par[l].y = par[l].y + crap*(par[l-TABX].y - par[l].y + par[l+TABX].y - par[l].y); // thats motion made relation only for the nearest points ( 4 point influance )
//*****************************************************************************************************************************************************************************
//par[l].x = par[l].x + crap*(par[l-1].x - par[l].x + par[l+1].x - par[l].x + // Same as before but i added aditional point
// par[l-1-TABX].x - par[l].x + par[l+1-TABX].x - par[l].x + // in the 45deg directions ( 8 point influance )
// par[l-1+TABX].x - par[l].x + par[l+1+TABX].x - par[l].x +
// par[l-TABX].x - par[l].x + par[l+TABX].x - par[l].x);
//par[l].y = par[l].y + crap*(par[l-TABX].y - par[l].y + par[l+TABX].y - par[l].y +
// par[l-TABX+1].y - par[l].y + par[l+TABX+1].y - par[l].y +
// par[l-TABX-1].y - par[l].y + par[l+TABX-1].y - par[l].y +
// par[l-1].y - par[l].y + par[l+1].y - par[l].y); // Another failure
//*****************************************************************************************************************************************************************************
//par[l+1].x = par[l+1].x + crap*(par[l+1].x - par[l].x + par[l-1].x - par[l].x); // Final aproach if this wont work i dont know what will :( ( 4 point displacement )
//par[l-1].x = par[l-1].x + crap*(par[l+1].x - par[l].x + par[l-1].x - par[l].x);
//par[l+TABX].y = par[l+TABX].y + crap*(par[l+TABX].y - par[l].y + par[l-TABX].y - par[l].y);
//par[l-TABX].y = par[l-TABX].y + crap*(par[l+TABX].y - par[l].y + par[l-TABX].y - par[l].y);
}
}
- Attachments
-
- ElasticPlaneSymulator_v1.01.rar
- (135.02 KiB) Downloaded 303 times
Re: Elastic surface symulator
Hi yah,
don't know what you were going after in your code, but when I click once and stop the mouse movements the ripples are getting back to their default state, more or less.
Here's the project where I added your code. If you could explain a little more what you are after, maybe some of us would know what to look for.
Either way the effect is still kinda cool.
don't know what you were going after in your code, but when I click once and stop the mouse movements the ripples are getting back to their default state, more or less.
Here's the project where I added your code. If you could explain a little more what you are after, maybe some of us would know what to look for.
Either way the effect is still kinda cool.
Re: Elastic surface symulator
this is some nice effect , mouse in effect happens, mouse out effect stops
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Re: Elastic surface symulator
I see what you did there but it's still not what i am trying to do. Right now it just goes back to it's default position initialized in IniParticles() function which i still very cool effect.
I want this mesh to behave like a real elasto-like sheet. Not sure if you get what i mean "crazy man talking ;p".
I have few ideas how to do it but right now now much time ;p
I will make another update after new year.
Anyway thanks for help and happy new year ;p
I want this mesh to behave like a real elasto-like sheet. Not sure if you get what i mean "crazy man talking ;p".
I have few ideas how to do it but right now now much time ;p
I will make another update after new year.
Anyway thanks for help and happy new year ;p
- thetoddfather
- Posts: 338
- Joined: October 1st, 2012, 9:53 pm
- Location: Canada
Re: Elastic surface symulator
I'm picturing a sniper game with this one haha, very cool
Re: Elastic surface symulator
Lol this is a really neat effect, the math sounds really complicated . Do you mean your trying to make the mesh behave like a flag on a pole or something?
Re: Elastic surface symulator
Neat little simulation there fliper. Makes my fingertips itchy to code.
I'm not sure if I can solve your problem because I'm not 100% sure of what you're aiming for. If my guess is correct though, I think you need to model your simulation more closely to the laws of physics. Specifically, you probably need to implement Hooke's Law + Newton's Second Law.
I've made a simple simulation that does this (more for the lawz than to solve your problem). It's pretty simple, but it's also highly object-oriented. If you're down with OOP, it should be easy to follow. Take a look at it here if you're interested; it may or may not give you some clues.
I'm not sure if I can solve your problem because I'm not 100% sure of what you're aiming for. If my guess is correct though, I think you need to model your simulation more closely to the laws of physics. Specifically, you probably need to implement Hooke's Law + Newton's Second Law.
I've made a simple simulation that does this (more for the lawz than to solve your problem). It's pretty simple, but it's also highly object-oriented. If you're down with OOP, it should be easy to follow. Take a look at it here if you're interested; it may or may not give you some clues.
Chili