Before we start let me clear this, this not really custom collision but how to take a cube and stretch it to transform it to a big flat surface, a wall, a giant cube, a giant pillar etc whatever you want whatever you can do stretching a cube :p
Yes this is boring to do the first time, once you get how it works it's fine, but i hope someone will make an app
Please just try once you'll see it's not as complicated as the tut is long...
What we need:
-Entity
-Coll and my PHMO plugins that you can get at the bottom of the thread
-Preferable: basics and understanding of 3D modeling
-Headlong.map
Allright, as always i'll first explain what we are going to do and why.
I am going to take the object called "objects\gear\human\industrial\crate_multi\crate_multi"
Transform it, stecthing it, why do it take this one? it's simple, this object is a cube, the most basic from that can exist in this physics engine.
Second, what's the difference between coll and phmo?
Coll: collision detection model for projectiles but also weapons when dropped on the ground.
Phmo: physics model, for physics reactions, physics interactions between objects such as, mach, bloc,bipd,vehi.
As i said this is a basic model, the most complex task in the example will be Coll, first we need to understand it, to visualize it, phmo is not as complex as coll in this example because it's not using a model:
Phmo has one reflexive for parallelepipedals models(cubic forms) that you can resize with 3 values, xyz,instead of having a model formed by vertex,planes etc.
I am not saying phmo does never use a model, just in this example it doesn't, complex phmo use models but i didn't tried to modify these yet and those are much more complex than coll.
Resizing Coll
Open Entity
Select the tag: coll - "objects\gear\human\industrial\crate_multi\crate_multi"
Open Meta Editor
Wh4t r t3h r3fl3hx1v3hs?
Ok, here is a little explanation of some of the reflexives we need to understand to modify the coll, those that i won't explain are just used for breakable surfaces or count the number of planes and vertex...
Go at the bottom and find "vertrices" reflexive.
This coll model has 8 vertex which form a cube, one vertex is placed in space with the coords XYZ.
Above, Edge buffer, an edge is formed by 2 linkex vertex.
The Edge buffer defines how the vertex are linked and their order forward and reverse edge and the planes(surfaces) that the edge is part of (Left right surfaces).
Planes reflexives:
4 vertex form a plane, which needs to have a facing direction define by the axis ijk and d defines the distance from the intersection of the XYZ axis, coord 0, where the plane 0 is located(so d is the center of the plane (intersection of diagonals) and ijk is its facing direction).
Here is a 3D representation of the coll model:
For those that already did some 3D modeling i guess you don't need to look at this image
Allright now the problem is, yeah fine it's a cube for sure, but how do i know what i am gonna mooove?
There is the problem, but what i explained above give you the solution.
We have our 8 verte, which are 8 chunks, in the order 0 1 2 3 4 5 6 7,
Simple as this, draw you a cube in a papier, place each vertex as the chunks 0 1 2 3 4 5 6 7 give you the coords for x y z and label each vertex on your cube.
You should get this:
Let's say that you want to stretch your cube now, no wait, you'll need to change the planes information too *sadface*
Planes reflexives:
4 vertex form a plane, which needs to have a facing direction define by the axis ilk and d defines the distance from the intersection of the XYZ axis, coord 0, where the plane 0 is located.
Allright, let's say that we want to enlarge our cube to make a pillar, because PHMO is resized symetricaly using coord 0 as symetrical axis.
Actually the Y size of our cube is of 0.9 units, let's say that i want to make my parallelepipedal of Y= 2
So we will have to move vertex 0 3 4 5 + plane 2 setting Y=1 and vertex 1 2 6 7 and plane 4 setting Y=1
Which should look like this now:
So first we can editing the Vertex reflexive's chunks.
Vertex Chunk 0:
-0.45 x
1 y
0 z
3 First edge
clic save
Vertex Chunk 3:
0.45 x
-1 y
0 z
1 First edge
clic save
Vertex Chunk 4:
-0.45 x
-1 y
0.9 z
4 First edge
clic save
Vertex Chunk 5:
0.45 x
-1 y
0.9 z
5 First edge
clic save
Now do the same for vertex 1 2 6 7, change Y to 1, but keep the value to negative if it is.
Once you have done this go to planes reflexives, we need to update this too to define the distance d of the plane from coord 0(which is the center of the plane 0 btw)
Allright, vertex 0 3 4 5 is plane 2 setting and vertex 1 2 6 7 is plane 4
So go to planes reflexive on the chunk 2 we only need to change d vakue which is 0.45 to 1 and Save
Same thing for plane 4 change d 0.45 to 1 and Save
We are done with coll.
Now phmo, this is much more simple ^_^
Go to the tag
phmo - "objects\gear\human\industrial\crate_multi\crate_multi"
Open Meta Editor
Find the reflexive "Parallelepipedal Physic Model"
Change Y Size to 2 Save.
Note that you can also change the location of the phmo because sometimes you'll need to so the phmo and coll are perfectly place one over the other, to do this you have at the bottom of this reflexive the values X Y Z position.
Now you just need to stretch your MODE so it has the same size as phmo and coll.
Spawn this as a mach, take a mach spawn it's hlmt to the crate multi hlmt.
When you spawn this as a bloc it works but the physics are not fine as we resized it it needs tweaking for the phmo and there are still a lot of unknown values, i'd suggest to multiply the "Moment of inertia" axis you sterched by the factor you resize you phmo and coll on the Phmo Parts reflexive, but it's not enough to get realistic physics for the resized phmo just a little tweak.
so this should be pretty much used for static phmo, unmovable surfaces as mach etc.
Resize model
Go to your mode tag
Open meta editor
Search "Bouding Box" reflexive, resize XX, YY,ZZ coords are needeed
Note that as you resize the box you may want to resize the uv too (UU VV)
That's all, and post your new objects tags!!!
-neodos