Open HeadshotsOps opened 1 year ago
what i usually do is apply all transforms to the collision mesh / boxes, then convert to composite, then recenter their origins so that the BVH and composite are created at the origin.
Interesting, your method basically achieves the same end result as the fix by making that piece of code useless since everything is at the origin then. The question would be though what is considered the "right" approach. I'd personally consider your method more of a workaround then what should be standard procedure. So maybe that location logic in boundhelper should be removed?
Interesting, your method basically achieves the same end result as the fix by making that piece of code useless since everything is at the origin then. The question would be though what is considered the "right" approach. I'd personally consider your method more of a workaround then what should be standard procedure. So maybe that location logic in boundhelper should be removed?
Yes my method is a workaround, if you found a way to fix this in the code feel free to PR it :)
This is how I fix it.
import bpy
def fix_cols_locations():
selected = [empty for empty in bpy.context.selected_objects if empty.type == "EMPTY" and "bvh" not in empty.name]
bpy.ops.object.select_all(action='DESELECT')
for empty in selected:
for child_bvh in empty.children:
for obj in child_bvh.children:
if obj.type == "MESH" and "poly_mesh" in obj.name:
bpy.context.view_layer.objects.active = obj
bpy.ops.object.transform_apply(rotation=True, scale = True)
coords = empty.location.copy()
print(obj.name)
empty.location = [0.0, 0.0, 0.0]
obj.location = coords
fix_cols_locations()
When you select multiple bound poly objects and use the "Convert to composite" button with: Child Type "Bound GeometryBVH" Separate Objects = false Apply Default Flag = true Center to Selection = false
The BHV parents are moved to the poly mesh location and the poly meshes location is cleared. Testing ingame the collision does not work even though it shows up in the correct spot in Codewalker. Rockstar also seems to keep their BHV transform at the origin and their poly mesh at world coords. After modifying line 137 and 138 in boundhelper.py, the collision works as expected
Am I overlooking something here? It seems weird nobody complained about this before