Hi guys, I’m looking for the best way to have a following setup:
- Actor consists of one main body (collision box) with physics enabled - I want to control it through AddForce/AddTorque in C++
- Actor contains several other collision boxes that can move, and I want them to have an impact on main body physics like it’s a single welded rigid body
- For those several other collisions I want to have hit events
- Those collisions can have some intersections
For example, let’s have a tank - it has a body I want to simulate and a turret with long cannon. I want that if player collides with that cannon, it generates a force and torque to main body like it’s a single welded rigid body.
Trying to achieve that, I ended up with that setup:
Main body is just a small box with simulate physics == true, and collisions == block all dynamics
Secondary bodies are attached to it directly with simulate physics == off and collisions == block all dynamics
A top of that there is a static mesh with convex collision to better represent the main form
At the end, it works, but it took a lot of time for me to find a proper setup to satisfy all my requirement. Also because of the plain hierarchy it will take additional efforts for me to control all rotations manually in C++.
I know that it doesn’t look like a very clear approach, but is it ok to have it like that in general? What approach would be cleaner in your opinion?