Box2D explosion demo

  Рет қаралды 74,245

iforce2d

iforce2d

Күн бұрын

Пікірлер: 53
@Reach41
@Reach41 3 жыл бұрын
I was just crashing around the deep end of the Internet searching for something odd enough to look interesting, and look where I wound up! I’m not sure what this is, or what the application is used for, but the graphics at around 4:00 also describe Monte Carlo localization using ranging sensors in a space with an a priori map. I coded all this into a Hero 2000 around 20 years ago, including populating a probabilistic occupancy grid from Sonar data to use for a map. Pretty cool, because my Hero could get powered on anywhere in the room, and figure out it’s location and orientation with a single Sonar survey. Now, of course, the fun and the challenge are gone, replaced by GLONSS.
@iforce2d
@iforce2d 3 жыл бұрын
This is a 2d physics library most commonly used for games. It's quite a small library so became popular for use in mobile games, Angry Birds and Hill Climb Racing probably being the most well known.
@homeopathicfossil-fuels4789
@homeopathicfossil-fuels4789 2 жыл бұрын
GLONSS? I searched it and google corrected it to GLONASS, some sort of russian GPS equivalent, is that what you mean? Also I looked up the Hero 2000.. What a cute robot! Both technically and aesthetically. Certainly beat my LEGO Mindstorm set by miles! Nice job on the sonar. As iforce2d said, box2d is a popular library, but I must add that a number of different desktop based educational software utilize the library too. If you search box2d here on youtube there are several mechanical simulations of everything ranging from pendulum clocks to internal combustion engines! I've set up a bunch of sims of repeating firearms with the system too. Box2d is a seriously versatile library :D
@mmankt
@mmankt 11 жыл бұрын
i remember doing a particle system with box2d's circles(small, minimal mass,locked rotation) in flash and in a game environment the max was 200 circles at once-i made a custom particle system with collisions based on raycasting and moved to 2000 particles. a similar method could be done to save on tons of performance with continuous custom raycasting, with the user doing the bouncing.
@tobi3497
@tobi3497 8 жыл бұрын
With the particle variant of explosion, could you combine with the ray cast method. So, find objects within range of explosion, and then send the impulses at the boundaries of how much is in view, so either at the ends of the object (if the entire object is in view of the blast), or the ends of what is in view - the forces applied at the points would be proportional to their distance from the explosion. And then repeat the process from the 2 locations, at a lower force, eventually dampening to 0 force and stopping. I don't know whether this would be more efficient than sending out balls, but it also might make it more accurate, as the ball explosion increases in accuracy, with the more balls you add, the way i thought of might be accurate initially. I don't know much about this stuff, I'm just a 16 year old interested in computer science.
@iforce2d
@iforce2d 8 жыл бұрын
If you feel like calculating how all the 'particles' will bounce and reflect by yourself instead of letting the physics engine do it, I think it would work.
@keepeetron
@keepeetron 9 жыл бұрын
I'm making a game in javascript so performance is a big consideration. I wanted the delayed knockback (like in your third method) but instead of adding a bunch of invisible phys objects, I just made a circle that expands rapidly (the shockwave), when any object is within the outer/inner barrier of the shockwave, it then checks if it has a clear line to the explosion centre, and then applies the force. Having the shockwave is also good because you can apply a subtle distortion shader to it. It still has the problems of the first method though, where the force is applied to the origin point of the object instead of proportionally against the exposed sides, so I just add some random angular velocity, it's really hacky but even a tiny bit of spin makes it look okay.
@iforce2d
@iforce2d 9 жыл бұрын
Yeah, the nice thing about explosions is that they are very fast and fairly chaotic by nature, so it's easy to make it look good with some simple fakery :)
@jfelrod1960
@jfelrod1960 8 жыл бұрын
Chris this is an excellent tutorial!!! Thanks!
@homeopathicfossil-fuels4789
@homeopathicfossil-fuels4789 2 жыл бұрын
Got any suggestions for someone trying to simulate expandi9ng gas/vapor in a rocket engine or a thruster? I want to simulate various pumping mechanisms (from simble gravity feed to gas turbine) and ignition methods (autoigniting fuels that mix in ignition chamber, sustained combustion from regular electrical spark etc) and even more exotic things like water steam based resistojets and NTRs
@DaeOh
@DaeOh 11 жыл бұрын
Beautiful. Dubble subbed. Do you have gravity disabled on the "particles" or anything?
@MilanKarakas
@MilanKarakas 8 жыл бұрын
I think that last part is more correct with particles. Just add air particles, and you will get complete different picture about sound and pressure wave propagating. First example is as if you connected all elements by some rod with infinite speed of sound, so no surprise that in example where you place explosive between two objects of equal sizes, you have more force on one to the right with four "sticks", than left one with just one. For example, if this line represent 1 Joule of energy, then to the left body, there is just one, but to the right is four times that much, or each element (of four) has 1 Joule of incomming energy.
@MilanKarakas
@MilanKarakas 8 жыл бұрын
Oh, yes... Ray example is also wrong, because there are not set amount of reflection and absorption of such, so it is even more unrealistic.
@Newtov
@Newtov 11 жыл бұрын
Can be fixed by adding slow motion effect for explosion time :)
@ashishkarnkarnashish
@ashishkarnkarnashish 8 жыл бұрын
It looks so cool... I am leaning Box2d..and i will do everything possible to be good at it.. i wanna make things like this.
@aiadvisorist
@aiadvisorist 11 жыл бұрын
Its a nice, but what about productivity? If apply this method on javascript, I think, that FPS is fall
@ferozmouhamad7192
@ferozmouhamad7192 9 жыл бұрын
I downloaded many Box2D files, and I don't how to open these lol ... I have only CPP files. What Soft do you use to develop?
@iforce2d
@iforce2d 9 жыл бұрын
+Feroz Mouhamad Those source code files would be for use with the Box2d testbed, the program I am using in this video. You can see some info on how to add a 'test' to the testbed here: www.iforce2d.net/b2dtut/making-a-test (see also the preceding topics)
@Newtov
@Newtov 11 жыл бұрын
Raycasts in flash Box2d 2.1a sometimes "don't see" some bodies - it's well known bug. It happens rarely, but it can frustrate players. In my game Natural Selection bees for exaple sometime looked through walls with raycasts. Now I just test points along "raycast" with some small step using world.QueryPoint. And it works in 100% cases.
@darkhunter777
@darkhunter777 6 жыл бұрын
Do you know how make it lighting in C++ for BoX2D ?
@ssuriset
@ssuriset 4 жыл бұрын
If you don't understand what he's talking about, look up "How explosives/grenades work".
@MrMokaBoka
@MrMokaBoka 9 жыл бұрын
What is this GUi environment that you are using to create games with Box 2D? .. is it available with Java?
@iforce2d
@iforce2d 9 жыл бұрын
Hosam S It's my box2d editor. Search google for "box2d editor" :)
@MrMokaBoka
@MrMokaBoka 9 жыл бұрын
Thanks! :D
@Newtov
@Newtov 11 жыл бұрын
Particles are the best way to make realistic explosion becouse of wave reflection and delay effects. But collision effect of such particles with other dynamic bodies depends of FPS very much unfortunately :( It's not a problem becouse you can set FPS for your test your gameplay balance. But players with slow computers will receive less effect of such explosions and it will be the problem. I tested it and don't know how to fix this :(
@-danR
@-danR 9 жыл бұрын
8:52 Why would the particle impacting the ball/cylinder rebound up, rather than back, or down.
@iforce2d
@iforce2d 9 жыл бұрын
hmm... I'm not quite sure. Keep in mind that those yellow lines are not the path travelled by the 'particles', they are just a line between successive positions, and the bodies are being moved in discrete steps. An easier to see example of this (also at 8:52) is the one that gets deflected down from the platform above - the yellow line does not actually reach the platform. I'm guessing there is something like that going on with the ball/cylinder as well, but I can't quite visualize what exactly might be happening.
@master1140
@master1140 9 жыл бұрын
perhaps due to the particle's high velocity (or relatively large simulated time step), it does rebound downwards and back up in less than one time step?
@iforce2d
@iforce2d 9 жыл бұрын
GeoffPK Yeah. Now that I take a better look, I think the double-bounce has already happened at 8:44, and the particle is in fact heading upward at that point. But just by coincidence the particle is very close to the surface of the large ball, and because the yellow trail is drawn heading toward the large ball, it makes it look like they are colliding. So I'm thinking, they do not actually touch at the 8:52 step, or if they do, it's only a very slight grazing touch.
@kamilbeben9900
@kamilbeben9900 7 жыл бұрын
Very interesting video, i will definitely make use of it :) Thanks.
@8gres8
@8gres8 7 жыл бұрын
Kamil Bęben kzbin.info/www/bejne/epmXZoybj6iBe5I
@mmankt
@mmankt 11 жыл бұрын
interesting method with the particles. in my game i just apply force to all objects in the explosion radius and only raycast to destructible ones and characters to save on performance. it looks good and only sometimes you see some objects jumping cuz of an explosion a wall behind. i think this is the realistic real use method. (i have tons of explosions and physics objects and it's as3)
@Pompiduskus
@Pompiduskus 6 жыл бұрын
Looks great !
@appukumar1908
@appukumar1908 7 жыл бұрын
how to remove group of body remove at the same time through contactlistner. like bubble shooter game?
@iforce2d
@iforce2d 7 жыл бұрын
www.iforce2d.net/b2dtut/removing-bodies
@appukumar1908
@appukumar1908 7 жыл бұрын
but it can destroy single object which collide through contactlistner. but i want to destroy that single body and also those body which are match to that or nearer to that
@iforce2d
@iforce2d 7 жыл бұрын
Okay, so make a note of which ones you want to destroy, but don't destroy them inside the contact listener. Just put them into a list. After the world step has finished, you can destroy them. It is not safe to destroy bodies (or change the world in any way) inside the contact listener. Just because you tried it and it worked ok sometimes, does not mean it will be safe every time.
@appukumar1908
@appukumar1908 7 жыл бұрын
plzzz give me ur mail id . i will give you java class file.
@TheVcoder
@TheVcoder 11 жыл бұрын
Thanks for the tut, verry instructional. Good job, keep it up
@THMCTerracraft2
@THMCTerracraft2 9 жыл бұрын
Ta muzyczka w tle przypomina mi angry video game nerda, polecam go btw
@HartMF
@HartMF 6 жыл бұрын
as I can have the program you can not leave me a mediafire link please :)
@iforce2d
@iforce2d 6 жыл бұрын
I don't know what mediafire is sorry. Follow the link in the video description, the source code is available there.
@HartMF
@HartMF 6 жыл бұрын
is that it's my first time using box2d. I downloaded it from many links and the program does not help me, I would like you to help me with that :)
@iforce2d
@iforce2d 6 жыл бұрын
If you are a beginner, start at the beginning :) www.iforce2d.net/b2dtut/introduction
@TanjoGalbi
@TanjoGalbi 7 жыл бұрын
Learn the definition of "tutorial", tutorials show you how to do something. This is not a tutorial, it's a demonstration.
@iforce2d
@iforce2d 7 жыл бұрын
If I had a dollar for every time I had to tell someone to read the video description, I would be a rich man.
@TanjoGalbi
@TanjoGalbi 7 жыл бұрын
It's a good job you did not get a dollar every time you had to tell someone to read the description otherwise you would be having to return a LOT of money :P Just because there is a link to a tutorial related to the video on an external site does not make the the use of "tutorial" in the video's title valid. You are describing the video in the title, not the external tutorial.
@iforce2d
@iforce2d 7 жыл бұрын
That makes no sense, why would I return money? In any case, from the point of view of the tutorial itself, KZbin _is_ the external site. You just happened to find this page first. You also need to consider SEO when naming things like this. Try searching google for "box2d explosion tutorial" and see how this video and the tutorial are right there together because they go hand in hand, just like I intended. Well, until now that is, because I have changed the video title, so maybe now you can stop whining.
@TanjoGalbi
@TanjoGalbi 7 жыл бұрын
Let me just quickly address a few things you just said. "That makes no sense, why would I return money?" Sure it makes no sense that you would have to return money, but then it also makes no sense that you would get a dollar for every time you pointed out the description. I am sure you are intelligent enough to know it was a humorous (as indicated also by the tongue out emote) response to your previous comment. "from the point of view of the tutorial itself, KZbin is the external site" Sure, if you found the web site before the KZbin video. But many people, like myself, would have come across the video first. In my case it was recommended after watching another related tutorial that actually was a tutorial! Specifically a tutorial on using Box2D in the Processing Java language. "Try searching google for "box2d explosion tutorial" and see how this video and the tutorial are right there together because they go hand in hand" Of course they go hand in hand when you are that specific in a search! Try doing a more generic search that people are more likely to enter, like "box2d video tutorial". In that case you would have got the video only, not the accompanying web site. "I have changed the video title" Well done. You may not have been very polite in your response to valid constructive criticism but at least you took it into consideration and made a change. "so maybe now you can stop whining." Since when is constructive criticism called whining? So I can only assume that this is an attack on my character! Not a good idea I assure you :)
@TanjoGalbi
@TanjoGalbi 7 жыл бұрын
I said quickly at the start of that! 😆 😀
Box2D mountain-bike
19:56
iforce2d
Рет қаралды 71 М.
Making Hollow Knight physics using my Custom C++ engine and Box2D.
4:58
Low Level Game Dev
Рет қаралды 7 М.
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
MY HEIGHT vs MrBEAST CREW 🙈📏
00:22
Celine Dept
Рет қаралды 17 МЛН
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 21 МЛН
GDC 2014: From Box2D to Liquid Fun: Just Add Water-like Particles!
20:16
Google for Developers
Рет қаралды 16 М.
GodotPhysics2D vs Box2D 2.4.1 vs Rapier2D 0.17.2
4:23
Dragos Daian
Рет қаралды 4,2 М.
A simple procedural animation technique
8:31
argonaut
Рет қаралды 420 М.
Remote Control Tank Robot Chassis (RTC300)
7:38
Vigorun-Remote Control Lawn Mower
Рет қаралды 2,4 М.
Box2D 2D Physics Engine
10:45
Gamefromscratch
Рет қаралды 44 М.
Introduction to R.U.B.E Box2D editor
25:22
iforce2d
Рет қаралды 64 М.
Evolution of Box2D Engine Games 2007-2019
11:13
GameForest
Рет қаралды 10 М.