- #1
Nanako
- 39
- 0
Hi all x I'm doing some physics related code for a game in unity engine. Unity does have a very full featured physics engine, but i can't utilise it in certain circumstances.
I have a wall made up of pre-fractured little chunks, and each chunk has a connective strength which represents how difficult it is to knock loose from the wall. This strength is calculated as the Tensile Strength of the material (MPa) multiplied by the surface area this chunk shares with other chunks (M^2). Therefore i believe this value is in Newtons, and it approximately represents the magnitude of a force required (regardless of direction, or point of application on the surface) to break it loose from the wall and set it free.
Once that part's done i can hand it over to unity's built in physics engine, but while it's still attached to the wall it is an immovable object, and so i need to manually simulate physics in the case of collisions here.
I've been reading up on F=MA, but the problem here is that virtual objects don't stretch and deform like real ones, generally, so collisions generally happen in an instant, between singular points, rather than over any appreciable period of time or surface area. This has left me somewhat confused as to how to apply Newton's laws, I need help.
So, my objectives:
1. When an object hits the wall, i need to determine the force it's going to apply, and see if it goes above the chunk's strength. (but how?)
2. If it does, then the chunk will be knocked loose, and i need to set the new velocities of both the chunk, and the colliding object, taking into account the energy lost from breaking off the chunk. so the collider will be slowed somewhat, depending on it's mass/energy, but not brought to a complete stop.
Step 2 is needed because unity will normally see this collision as between a normal physical rigidbody, and a static/immovable object, which results in the former being brought to a complete halt. manually setting the velocities to what they ought to be is the only way i can think to work around thisIf the force is too low, i'll just have the collider stop, or bounce off. the built in engine can handle this easily
I have a wall made up of pre-fractured little chunks, and each chunk has a connective strength which represents how difficult it is to knock loose from the wall. This strength is calculated as the Tensile Strength of the material (MPa) multiplied by the surface area this chunk shares with other chunks (M^2). Therefore i believe this value is in Newtons, and it approximately represents the magnitude of a force required (regardless of direction, or point of application on the surface) to break it loose from the wall and set it free.
Once that part's done i can hand it over to unity's built in physics engine, but while it's still attached to the wall it is an immovable object, and so i need to manually simulate physics in the case of collisions here.
I've been reading up on F=MA, but the problem here is that virtual objects don't stretch and deform like real ones, generally, so collisions generally happen in an instant, between singular points, rather than over any appreciable period of time or surface area. This has left me somewhat confused as to how to apply Newton's laws, I need help.
So, my objectives:
1. When an object hits the wall, i need to determine the force it's going to apply, and see if it goes above the chunk's strength. (but how?)
2. If it does, then the chunk will be knocked loose, and i need to set the new velocities of both the chunk, and the colliding object, taking into account the energy lost from breaking off the chunk. so the collider will be slowed somewhat, depending on it's mass/energy, but not brought to a complete stop.
Step 2 is needed because unity will normally see this collision as between a normal physical rigidbody, and a static/immovable object, which results in the former being brought to a complete halt. manually setting the velocities to what they ought to be is the only way i can think to work around thisIf the force is too low, i'll just have the collider stop, or bounce off. the built in engine can handle this easily
Last edited: