When the star beam touches a player (including a stationary one), stop spinning and start hitting

Warning: the text of this question has been translated from another language, strange language constructs are possible.

There is a big star. The player must be able to pass between the beams and hit her. At the same time, these rays rotate, and if one of them touches the player, the star already begins to beat him. Importantly, it should work regardless of whether the player is moving or standing. Moreover, if the player is between the rays, his health should not fall, that is, the shape of the collision should repeat the shape of a star, and not just be a convex shell. How can I do that? At least a few key phrases. Here’s what I’ve tried:

  • Hit and BeginOverlap events. The first does not fire when the player is standing, and the second fires or does not fire randomly, so the star continues to rotate periodically.

  • SkeletalMesh with Enable Per-Poly Collision and StaticMesh with Use Complex Collision As Simple. In both cases, when using BeginOverlap, the convex hull collides rather than the exact star shape.

  • Stop hitting during EndOverlap or if BeginOverlap has been absent for some time. In the first case, due to a known bug, they stop before starting (BeginOverlap and EndOverlap work together, one immediately after the other), in the second, due to the first point, situations are inevitable when, during this time, no matter how long it would be, BeginOverlap does not work even once, and the star makes a scanty, but turn. In addition, if this time is too long, the player will receive blows even after he has moved away from the star.

EDIT: BeginOverlap and EndOverlap unexpectedly have got working correctly. But complex collision is not working neither for skeletal mesh nor for static one. I even tried to split the star into multiple meshes by beams but it is some kind of paradox that even in this case player collides with the bounding box of the star, not with every beam. Why it can be so?

EDIT2: I have detected that BeginOverlap and EndOverlap work incorrectly only if enable per-poly collision on skeletal meshes. So it is better to use static meshes. Now the star correctly collides, for example, with the bush (HISMActor), or with the weapon (Actor - Weapon - NearFightingWeapon - FighterOMB) (OMB is an in-game code name), or with the player name (Widget) (now this collision is disabled to prevent errors), but not with the player capsule. So the problem is in the player capsule. What can it be? Here is the screenshot of the collision parameters of the player capsule.

Hello! Can you provide more information:

  • what type of actor is Star, what collision components it has?
  • the same for player
  • the same for beams
  1. Actor - Pawn - Character - Enemy - ShootingEnemy - WhiteStar_Blueprint. It has default capsule, but it is not used. Also it has skeletal mesh WhiteStar with Enable Per-Poly Collision in the settings of mesh and component, and also I tried static mesh WhiteStarStatic with Use Complex Collision as Simple. Both mesh components have collision type BlockAllDynamic with Generate Overlap Events and Simulation Generates Hit Events.

  2. Actor - Pawn - Character - Player - ProperPlayer - Fighter1Player. Here the default capsule is used, and it has the same collision type.

  3. Beams are just parts of the star, it is one whole mesh. I badly know how they are called in English, maybe not “beams”?

You could attach a StaticMesh to your star

Constantly rotate the StaticMesh

Use “OnBeginOverlap” to notify when the StaticMesh touches the Pawn

You say that you are using Skeletal mesh for Stars. Is this mesh is animated? If yes - ok, but if not, then it is much more effective to constaruct your object from several static meshes. It more optimal from collision and rendering point of view

Bump. I have done still one edit.

You could use a line trace. Then you won’t have to worry about geometry overlap events at all. In this case the LineTraceByChannel node is the one you want. Create a line trace along the beams each tick and it will tell you what actor it hits.

  • Set Start to the location of the star.
  • If you put a socket at the end of each beam in your skeletal mesh, you can set End to the position of the socket.
  • Check the Hit Actor to see if it’s the player.

PS It sounds like ‘beams’ is exactly the right word. ‘Rays’ is just as good.

Yes, it has got working! Thank you!

Excellent! Please can you accept my answer? Then it shows green in the list so people know straight away that you’ve solved it.

I see that your answer is voted up. Maybe you have not seen this yet?

Sorry, I haven’t yet understood that voting up and accepting are different things. Now your answer is accepted.

Thanks. I’ve voted the question up so you get some karma as well. :slight_smile: