DarkestHour icon indicating copy to clipboard operation
DarkestHour copied to clipboard

Destroyed Flakvierling, FlaK 38 & M45 don't stop players walking through

Open cmbasnett opened this issue 8 years ago • 5 comments

┆Issue is synchronized with this Trello card

cmbasnett avatar Jun 18 '16 04:06 cmbasnett

From a quick look, I don't think this a static mesh issue, or anything specific to the flakvierling or any other gun/vehicle.

It looks like any destroyed gun or vehicle is ignoring the basic, boxy collision in its destroyed static mesh, and is somehow keeping the collision from the skeletal mesh of its hull or base. The turret actor is destroyed at this point, so there is no collision for that, meaning players can walk through the turret of any destroyed gun or vehicle, if they can get to the turret.

This problem manifests itself on the FV, the static F38 and the M45 because they have very low bases, which the player can walk up and over. But if you paradrop or otherwise get onto the top of any destroyed tank, your player will be able to walk through the turret and on top of the hull.

This is very strange, as the "show collision" option in single player clearly shows the static mesh collision box, with the hull/base collision from the skeletal mesh having been removed (both the collision boxes and the collision static mesh). See attached pic showing this problem affecting the destroyed Firefly, with me having dropped onto it in single player: turretcollisionbug_destroyedfirefly

handsm avatar Jun 18 '16 13:06 handsm

You're probably right about this one. Perhaps it would a good idea to have the collision on the base be artificially taller so as to preclude running over top of it.

cmbasnett avatar Jun 18 '16 21:06 cmbasnett

Sorry I missed your comments on this one guys. Yea I concur about the skeletal mesh collision being used on the destroyed vehicle actor and not the SM collision. This is actually a good thing, IMO, because the collision boxes on the statics are setup for static world collision, not dynamic collision.

As to the fix for the flakvierling and other guns with this problem....

I think we should try the collision on the base taller, if it causes no issues with player hit detection. Otherwise we should look into keep the turret collision hit box around (at least on these guns).

AndrewTheel avatar Sep 08 '16 01:09 AndrewTheel

Dropping this from the 8.0 milestone because it is not urgent.

cmbasnett avatar Sep 25 '17 01:09 cmbasnett

I've occasionally tried, on and off, over the past few months to get a 'proper' fix for this working, by somehow making the collision switch to the new static mesh. My rough basis was to disable at least some of the vehicle actor's collision, then switch to draw type static mesh and set the mesh, then re-enable the collision, in an attempt to re-set the collision to the new static mesh. Don't think I found any documentation re this, but I saw something similar in the destroyable static mesh code when it switches between undamaged/destroyed meshes. I hoped this would work with destroyed vehicles, but I had no joy. I suppose the vehicle is switching from a skeletal mesh draw type, not just switching between two different static meshes like the DSM.

Recently I've done a quick test of a solution by making the collision box on the AT gun base much taller, so it effectively represents the whole AT gun, at least for player collision (projectile collision will use the smaller, more accurate collision static mesh for the gun base). I regard this as a dirty solution because it creates overlapping collision boxes, but it could well work and be an effective, if somewhat nasty, fix. My quick test, by making the M45 quadmount trailer base collision box much taller, seemed to work and caused no obvious problems with the overlapping collision boxes.

But a couple of days ago I had an idea, which I tested a little and it seemed promising and fairly simple. The vehicle base actor needs to persist for a while when the vehicle is destroyed, including to time its own destruction, and it still replicates to newly relevant net clients. Currently the RO code changes its appearance by switching it to a static mesh draw type and sets it to be the destroyed vehicle mesh. Instead the vehicle could set its draw type to be none, so it's no longer visible, but spawn a new 'destroyed vehicle static mesh' actor, attached to the vehicle. This would be a pretty dumb static mesh actor, not replicated, so it would have negligible resource implications. Players would see the destroyed static mesh and the game would use its collision.

From a quick test, this seemed to work ok. The only problem I noticed was when initially I disabled the collision on the vehicle actor, so only the destroyed mesh would be collidable. The problem was the gun factory spawned a new gun on top of the destroyed one. Debug logging showed the factory's once-a-second timer check for any blocking actor (which prevents a new gun from spawning if there's something in the way) failed to detect the new static mesh. I'm not sure why. But I quickly tried leaving the vehicle actor's collision enabled, as well as the destroyed static mesh, and that seemed to work ok. A promising solution but I didn't go any further for now.

handsm avatar Sep 27 '17 16:09 handsm