Something I've been having difficulty working out a solution to:
I have a level made almost entirely out of dynamic bodies, which collide with each other as normal, but I want to be able to add additional bodies as visual detail, for things like bullet casings and small pieces of debris. Their requirement is that they can collide with the rest of the world and respond by bouncing off etc. but not apply forces to any objects. Any suggestions to how I can accomplish this?
Adding bodies as detail objects
-
- Posts: 8
- Joined: Tue Jun 04, 2013 10:48 am
- Contact:
-
- Posts: 3
- Joined: Wed May 15, 2013 5:00 pm
- Contact:
Re: Adding bodies as detail objects
Hello, so the easiest way i could think of to do this would be to just make the mass of the detail objects extremely small relative to the level bodies mass.
i.e 0.0001* smallest mass of a body
That should make any force by a collision pretty much negligibly small
i.e 0.0001* smallest mass of a body
That should make any force by a collision pretty much negligibly small
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Adding bodies as detail objects
So one thing that is easy to do is to implement it so that the detail objects only interact with static geometry like walls and such. This is terribly common in games.
The problem with wanting the detail objects to only have unidirectional collisions is that they will often get stuck between two regular objects. Setting the mass to be very low will give you similar problems. When you have a shell casing that is sitting on top of a crate and the player steps on the crate, weird things are going to happen. The end result that you are expecting for is probably very specific to what your game is.
The problem with wanting the detail objects to only have unidirectional collisions is that they will often get stuck between two regular objects. Setting the mass to be very low will give you similar problems. When you have a shell casing that is sitting on top of a crate and the player steps on the crate, weird things are going to happen. The end result that you are expecting for is probably very specific to what your game is.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 8
- Joined: Tue Jun 04, 2013 10:48 am
- Contact:
Re: Adding bodies as detail objects
I think I'll try setting the masses to be tiny first. The game has a client/server structure, so if anything goes horribly wrong the server should be able to make up for it by sending over the correct positions pretty quickly. They're only going to be very short lived and simulated purely on the client, so it might be alright.
I did wonder taking a sort of double-buffered approach, where all the dynamic geometry is copied into another layer as static, and then simulate the tiny details in there, seems a little excessive though.
I did wonder taking a sort of double-buffered approach, where all the dynamic geometry is copied into another layer as static, and then simulate the tiny details in there, seems a little excessive though.
-
- Posts: 8
- Joined: Tue Jun 04, 2013 10:48 am
- Contact:
Re: Adding bodies as detail objects
Just to follow up, setting tiny masses does what I wanted, the character ploughs through as though they weren't even there. Thank you!
http://www.youtube.com/watch?v=kqVMI0Cw2zQ
http://www.youtube.com/watch?v=kqVMI0Cw2zQ
Who is online
Users browsing this forum: No registered users and 8 guests