Collision of Object doesn't match the static mesh when it rotates

Hello, I have made a master turret with child turrets that rotate towards a target, the turrets works well, however when it rotates the barrel collision does not match with its static mesh. (this is for all turrets in level regardless of how they are made)

The turret barrel collision appears to always face the original direction when it was placed despite the player and visibility collision showing otherwise Ingame, the video below shows me colliding/not colliding with it and hitting it with a line trace depending on its rotation.

An arrow is connected to the turret base and points to original direction it was facing.

the problem is I don’t know how to make the collision match the rotation of the barrel when it rotates, I’m guessing it might be because its parented to the turret base that doesn’t rotate maybe?


I can give more screenshots if needed.

Never seen anything like it :slight_smile:

What does the collision look like on that gun mesh in the static mesh editor?

image

here are all the pieces used in the turret





here are all the pieces used in the turret.

I don’t get it AT ALL :slight_smile:

Something you can try, is play, rotate the barrel, the press F8 and turn on player collision view.

You can see what’s happening then.

I’m not sure what it’ll be…

Mhm. Seconded.

  • could you briefly explain how the turret rotates?

I have made a master turret with child turrets that rotate towards a target

  • could you elaborate on this, too? What’s in the Construction Script / Begin Play events of master / child? Anything that could be relevant?

  • and finally, what are the collision settings of the offending barrel?

I don’t know how to make the collision match the rotation of the barrel when it rotates

Yeah, that’s not a thing. :confused:

1 Like

here are some


screen shots how the turet aims at the target

nothing in constuction script except for the child creating the parent construction script

when it detects target within range, adds them to list of potential target, when it has chosen a target it plays the begin aim custom event.

and here is turret collision settings…

The turret gun is ignoring player:

image

Is this intentional? Can we then also see the collision settings of the player capsule?


When it comes to this:

image

This is run on Tick, right? Nothing fancy? No subframe timer shenanigans?


A trick question: why is this needed:

Not sure if related but we’re grasping at straws here.

gun barrel ignoring player is intentional only there so it doesnt detect player

here is player capsule and mesh collision


when begin aim custom event is triggered it aims at player for a frame or something then it dleays for a delta world second, checks if it still has target in LOS if it does it triggers another custome event that plays the begin aiming custom event again

if it isnt there an infinite loop is made

Hm, at this point I want to blame that exact Delay thing - that’s the only thing that stands out here scriptwise; I might be wrong, ofc. UE5 now has this fancy boi, btw:

image


So… what are we actually standing on here then:

We’ve all assumed you’re standing on the barrel. Perhaps you are not. Could you try:


the “update turret for unreal gun” is the barrel

1 Like

Righto. We’re standing on the ignored one. The editor is drunk again. If this persists through editor’s “have you tried turning it off and on again” I’d then start disconnecting parts of script to see what creates this undesired behaviour.

I’m out of ideas that can be applied remotely. Are you using any plugins?


nothing in constuction script except for the child creating the parent construction script

Can we see what’s in there? What are the chances something is done to the:

We’re not simulating physics here, surely? Are we? The meshes set to Physics type threw me off initially but I discarded this possibility.

Constructions script for both master and children



constructions script for both master and children

I am simulating physics for some of the static meshe parts used for the turret

Hm. How so? What for? You’re setting rotation. Which parts? Could this be a welding issue?

it seems like when simulate physics is off it works perfectly, but i want to pick up the turret with my interact key ‘‘e’’

Phew. That makes sense. You do not need physics for that. How are you picking up the turret atm?


Could this be a welding issue?

Note to self - just to clarify.
  • the base (?) of the turret simulates physics
  • it has welded SMCs
  • the welded comps rotate
  • the welding causes the component’s collision to not be updated

Old physX won’t fix bug? Can we update the comp?

1 Like

line trace from camera, if it detects an object that has ‘‘interact interface’’ and tag ‘’ carryable’’ it picks it up

collision is solved now so thank you, pick up interact wont be difficult just some more adjustments

1 Like

@Q-18S If you ever find the time to test it out, you could try this on the comp that has the physics sim enabled.

ill test it out, thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.