[QUOTE=Overv;17283356]When using sf::Shape to draw shapes of Box2D, I take it's better to use a sf::Shape object for every shape than to use a single one and change it every time?[/QUOTE]
Unless there is batching already in SFML (I believe it's coming soon) then both will be pretty slow, but changing the sf::shape will be slower I reckon (taking a guess here). This is because either way SFML will use a glBegin and glEnd for each shape. If I'm wrong I'm sure someone will step in...
Since everyone is making games I'm working on one too :D.
[img]http://i32.tinypic.com/fw2kgm.png[/img]
Ill continue on my chat later. This is muuuuch more fun.
[QUOTE=ryandaniels;17282454]Actually, I just the object to fall down and stop moving, but it bounces all over the place for some reason.[/QUOTE]
D: But the bouncing rock is awesome. If you could get smaller objects to orbit around bigger ones (obviously a huge change in size) it would totally change the dynamics :O
[QUOTE=ddrl46;17283806]Since everyone is making games I'm working on one too :D.
[img]http://i32.tinypic.com/fw2kgm.png[/img]
Ill continue on my chat later. This is muuuuch more fun.[/QUOTE]
Facepunch Episode V: Revenge of the :v:
Facepunch 2: :v: HARDER
:v: of War
Section :v:
Team Fortress :v:
Offroad :v: Safari
:v: Tournament
:v:: Source
:v:: The Masquerade
Half :v:: Opposing :v:
Call of :v:: :v: at War
All of these are acceptable names for your project. (And reason for abusing the :v: Smiley)
(Please don't ban me :ohdear:)
[QUOTE=Chandler;17284882]D: But the bouncing rock is awesome. If you could get smaller objects to orbit around bigger ones (obviously a huge change in size) it would totally change the dynamics :O
Facepunch Episode V: Revenge of the :v:
Facepunch 2: :v: HARDER
:v: of War
Section :v:
Team Fortress :v:
Offroad :v: Safari
:v: Tournament
:v:: Source
:v:: The Masquerade
Half :v:: Opposing :v:
Call of :v:: :v: at War
All of these are acceptable names for your project. (And reason for abusing the :v: Smiley)
(Please don't ban me :ohdear:)[/QUOTE]
You forgot "Army of :v:"!
[QUOTE=ZomBuster;17282669]What method do you use? Just go trough all the astroids and calculate the gravity force they do on other astroids, then combine those and apply ?[/QUOTE]
Only the big asteroid has gravity, so all I do is apply a force every iteration to the center.
[code]
for(unsigned int i= 0; i< sim_bodies.size(); i++) {
b2Body *body= sim_bodies[i]->body;
float angle_to_center= ( Point()+ body->GetPosition() ).Angle( Point() );
Point force= Convert_FROM_DirMag(angle_to_center, 0.1f);
body->ApplyForce(force.ConvertB2D(), body->GetLocalCenter() );
}
[/code]
[QUOTE=Chandler;17284882]D: But the bouncing rock is awesome. If you could get smaller objects to orbit around bigger ones (obviously a huge change in size) it would totally change the dynamics :O
[/QUOTE]
Well technically it is possible to orbit, but it isn't really a feature I am specifically planning to add.
[QUOTE=Z_guy;17285034]You forgot "Army of :v:"![/QUOTE]
And ":v: Theft Auto I:v:"
Learning about APNG, hence the avatar :)
And working on my search engine stuff.
My game is just a little thing to get better at XNA lol :D (also :v:).
[QUOTE=ryandaniels;17285105]Only the big asteroid has gravity, so all I do is apply a force every iteration to the center.
[code]
for(unsigned int i= 0; i< sim_bodies.size(); i++) {
b2Body *body= sim_bodies[i]->body;
float angle_to_center= ( Point()+ body->GetPosition() ).Angle( Point() );
Point force= Convert_FROM_DirMag(angle_to_center, 0.1f);
body->ApplyForce(force.ConvertB2D(), body->GetLocalCenter() );
}
[/code]
Well technically it is possible to orbit, but it isn't really a feature I am specifically planning to add.[/QUOTE]
It's probably just the properties of the rock that causes the bouncing then I guess
When I first started python programming many, many, moons ago, the first thing I tried to make after learning if was to make a Text RPG. I never got very far as you could imagine. However I think I am going to take a break from graphics programming and do this project (as a side project to Virtu-Planner).Virtu-Planner is serious and I need something abit fun.
Anyone notice my new avater(based of actual code :D)
[QUOTE=ZomBuster;17285548]It's probably just the properties of the rock that causes the bouncing then I guess[/QUOTE]
That's what I thought originally, but Even if I increase the friction, lower the gravity, dampen the linear velocity or lower the restitution, it still does it.
And when I tried using normal gravity it worked.
My thread on the box2d forums still hasn't got a response and I want to move forward, so I think I'm just going to unwrap the asteroid's mesh and have it loop when you reach the end. Then I can just apply a simple downwards gravity.
I'm running out of site ideas. Right now I'm creating a sister site of Average Cats - Average Dogs. Not sure if people would like it, though.
Just for you, chandler;
[img]http://www.cubeupload.com/files/d79200orbit.gif[/img]
Although it will probably be gone for good once I switch to the new simulation method.
[QUOTE=ryandaniels;17287761]Just for you, chandler;
[img]http://www.cubeupload.com/files/d79200orbit.gif[/img]
Although it will probably be gone for good once I switch to the new simulation method.[/QUOTE]
:3: dawww
What happens if you have multiple objects rotating one larger object? Do they collide and possibly fling off into the distance :v:
Also for the guy doing the Python Text RPG take a look at
[url]http://roguebasin.roguelikedevelopment.org/index.php?title=Main_Page[/url]
It might come in handy
got inspired
[hd]http://www.youtube.com/watch?v=XVy89cJIrO0[/hd]
I should probably use some kind of formula instead of just 'move closer to gravity sources' :buddy:
[QUOTE=ryandaniels;17286918]That's what I thought originally, but Even if I increase the friction, lower the gravity, dampen the linear velocity or lower the restitution, it still does it.
And when I tried using normal gravity it worked.
My thread on the box2d forums still hasn't got a response and I want to move forward, so I think I'm just going to unwrap the asteroid's mesh and have it loop when you reach the end. Then I can just apply a simple downwards gravity.[/QUOTE]
Did you lower the restitution of the meteorites?
[QUOTE=Spoco;17288767]Did you lower the restitution of the meteorites?[/QUOTE]
No, but I very highly doubt that would have changed anything; nothing even had the slightest effect on them in terms of their bouncing glitch. However, I just barely solved the problem. I found that I didn't cause them to go crazy when I applied force via my controls, and I found that the only difference was that with my controls, I used
[code]
body->GetPosition();
[/code]
and with my gravity I used
[code]
body->GetLocalCenter();
[/code]
I changed it, and voila:
[img]http://www.cubeupload.com/files/b1d000fixed.gif[/img]
Also, new style!
[editline]01:27PM[/editline]
[QUOTE=Chandler;17288402]:3: dawww
What happens if you have multiple objects rotating one larger object? Do they collide and possibly fling off into the distance :v:
Also for the guy doing the Python Text RPG take a look at
[url]http://roguebasin.roguelikedevelopment.org/index.php?title=Main_Page[/url]
It might come in handy[/QUOTE]
Well they would most likely just decay in their orbit and fall to the ground, but if they did bounce off each other hard enough, they would just run into the edge of the map and become frozen.
Got my game to start a new game when the player dies.
Here is the video I posted last night:
[url]http://www.facepunch.com/showpost.php?p=17275510&postcount=107[/url]
So the difference now is that when health == 0, it deletes all the data, clears the screen, and shows the menu again. Then after pressing Enter it creates new objects. Doing that was frustrating. :3:
[QUOTE=iPope;17286388]When I first started python programming many, many, moons ago, the first thing I tried to make after learning if was to make a Text RPG. I never got very far as you could imagine. However I think I am going to take a break from graphics programming and do this project (as a side project to Virtu-Planner).Virtu-Planner is serious and I need something abit fun.
Anyone notice my new avater(based of actual code :D)[/QUOTE]
A text based game would probably be more fun to make for me since I suck at making graphics.
[url]http://averagedogs.exofire.net/steam/index.php[/url]
After a lot of fuss, I finally managed to do what all the big kids were doing :downs:
[quote=Box2D v2.0.2 User Manual]
Restitution is used to make objects bounce. The restitution value is usually set to be between 0 and 1. Consider dropping a ball on a table. A value of zero means the ball won't bounce. This is called an inelastic collision. A value of one means the ball's velocity will be exactly reflected. This is called a perfectly elastic collision. Restitution is combined using the following formula.
[code]
float32 restitution;
restitution = b2Max(shape1->restitution, shape2->restitution);
[/code]
[/quote]
So you'd have to lower both of them, right?
By the way, how big is that big meteor of yours in your physics world?
[QUOTE=Spoco;17289530]So you'd have to lower both of them, right?[/QUOTE]
It bounced much farther than it's speed would have allowed. In one test I did, I had the rock fall with very very low gravity; it was moving incredibly slow, and yet the moment it merely touched the surface it bounced off the screen.
[editline]01:47PM[/editline]
Also, I just learned a new operator
[code]
inline Fixed b2Max(const Fixed& a, const Fixed& b)
{
return a > b ? a : b;
}
[/code]
[quote=wikipedia]
condition ? value if true : value if false
[/quote]
cool
Yeah the ternary operator is very useful.
[QUOTE=Spoco;17289530]So you'd have to lower both of them, right?
By the way, how big is that big meteor of yours in your physics world?[/QUOTE]
They vary in size, 1 is the smallest currently, 10 is largest. So yes, they are correctly scaled.
It'd look nicer if you lowered the background green, I think ryandaniels.
[QUOTE=The Inzuki;17289466][url]http://averagedogs.exofire.net/steam/index.php[/url]
After a lot of fuss, I finally managed to do what all the big kids were doing :downs:[/QUOTE]
What's this meant to do? I enter my steam URL and it just displays my name...
[QUOTE=MADmarine;17290219]What's this meant to do? I enter my steam URL and it just displays my name...[/QUOTE]
I guess that's what the big kids are doing.
If only Steam Community had an API..
[QUOTE=thelinx;17290299]If only Steam Community had an API..[/QUOTE]
[url]http://steamcommunity.com/id/robinwalker?xml=1[/url]
About the best you're going to get.
[img]http://www.cubeupload.com/files/87600sfmlbox2d.png[/img]
Oh yeah and thanks for the font ryandaniels, it's perfect for debug text.
[QUOTE=MADmarine;17290219]What's this meant to do? I enter my steam URL and it just displays my name...[/QUOTE]
I dunno, I'm just bored and I've seen several people do it.
Right now I'm going to have it display 1 friend from the user's friends list.
Sorry, you need to Log In to post a reply to this thread.