Trace a line from the inside of a static mesh

Hi!

I have created a semi-sphere in the Modeling mode with any collision. I want to do a line trace from inside the semi-sphere and get the Impact point but the line doesn’t hit anything. I think the problem is, of course, with the semi-sphere, I have to set something to be hit by the line trace, or use another line trace node.

This is the semi-sphere. The player will always be inside:

This is what I’m doing right now.

This is what you see inside the semi-sphere:

How can I do it?

Thanks!

Hello @ViaCognita ,
If the semi-sphere has no collision, then the Line Trace will not be able to detect it, since traces work against collision and not against the visual geometry of a mesh. That’s why it’s normal that you’re not getting any hit result.

My question is: are you trying to create some kind of dome or enclosed area where the player has to find a specific point to exit or interact with something?

If you could share a more specific example of what you’re trying to achieve, it would be easier to understand the problem and suggest a better solution.

I also have another question: when you’re inside the semi-sphere, should you be able to see its inner walls?

If you can provide more specific details about what you’re trying to achieve, that would also be helpful.

I have added simple collision but after that, the player couldn’t go inside.

Yes, I’m trying to create a dome. The player will be always inside.

I want to know the (x, y, z) in world coordinates where the line trace hit the semi-sphere.

No, I don’t need to see the inner walls.

Thanks!

sadly this is engine limitation how geometry is created, i did find this workaround but you use 2 line traces

shoot line from player out and then shoot another one bat toward player so you get hit from outside, hope this give you some starting point to experiment on more perf solution

actually do this :D:D

You can try the following:
First, open the Static Mesh and generate a collision. In this example, I used Add 26DOP Simplified Collision, but you can choose whichever one best fits your project’s needs. Then, in Collision Presets, set Pawn and Camera to Ignore so that you can enter the dome.

After that, in the Break Hit Result, you can use Impact Point, which will return the X, Y, and Z coordinates of the point where the Line Trace hits.

In case you need another value, such as Impact Normal, I’ll leave the official documentation below, which explains what each of the values returned by the Break Hit Result node is used for.

Hope it helps!

What are you going to use the hit result for anyway? Depending the desired effect, there may be easier ways to find a location on a sphere.

To calculate its right ascension and declination.

That’s what I was trying to do as well, but I couldn’t work out how to go about it.

I’ll let you know the results.

I have tried your solution and it only works when the sphere has a collision. But, if I add a collision to the sphere the player can’t be inside.

I’ll let you know when it works. In other words, find a way to let player be inside when the sphere has a collision.

You just need a separate collison channel and have the sphere and the trace exclusively on it. Youll need this anyway as other actors could block the visibility trace

just set your collision to custom and set ignore pawn