I need to get the vertex group of one object that another object(RigidBody) has collided with. Is it possible to get vertex group(name) that was created in Blender, via API?
Hi, this is not possible right now. These options are not yet exposed from the bullet physics api that Armory uses.
Well, I can get the RigidBody of the object that bullet collided with, I can get its MeshData, and Geometry, but I nowhere can find anything similar to a vertex groups, that was created in Blender.
Technically, if:
rb.notifyOnContact(function(rb2) {
var verts = (iron.Scine.active.getMesh(rb2.object.name)).data.geom.vertices;
})
Will number of vertices be equal to whole model vertices or (if model is solid object, but consist of separate objects in edit mode) be equal to nums of verts in collided part? Should I set Blender RigidBody shape collision property to Mesh?
And one more question: how can I get bullet collision position? .getContactPairs?
Well, now I can get bones from object (RigidBody.object.animation.armature.action[0].bones). Which values of …bones.transform.values(Float32Array) is the position of bone(there are 16 values)?
Vertex groups are now available in armory, you can use the GetGeomNode if you want to try them.
That 16 values are the transform a Mat4 variable , you need to decompose it to get the location, this may help you:
In a 4x4 transformation matrix (often represented as a mat4), the values correspond to various transformations such as translation, rotation, and scaling in 3D space. The matrix is typically structured as follows:
| m00 m01 m02 m03 |
| m10 m11 m12 m13 |
| m20 m21 m22 m23 |
| m30 m31 m32 m33 |
In this matrix:
Translation: The translation components (the position in space) are found in the last column of the matrix. Specifically:
m03 corresponds to the x-coordinate of the translation.
m13 corresponds to the y-coordinate of the translation.
m23 corresponds to the z-coordinate of the translation.
Rotation and Scaling: The other elements of the matrix (the first three columns) are used for rotation and scaling transformations. The exact interpretation of these values depends on the specific transformations applied.
Homogeneous Coordinates: The last row (m30, m31, m32, m33) is often used for homogeneous coordinates. In most cases, m30, m31, and m32 are set to 0, and m33 is set to 1, which allows for the representation of points in 3D space.
To summarize, if you want to extract the translation vector from a mat4 transformation matrix, you would look at the values m03, m13, and m23. These values represent the x, y, and z coordinates of the translation, respectively.