LineTrace by Channel inside Static Mesh?

Hi all,

I am needing some expertise on ‘Line Trace By Channel’ and wondering if anyone has any insight on the following?

Here is the scenario…

I have a car (wheeled vehicle BP) with a cine camera inside it.

I am trying to run a line trace by channel (camera) to find the distance between the cine camera and the walls of the car interior.

The line trace works on the car from the outside, but when the camera is inside the car, it hits immediately in front of the camera. A print string of the collision component says that it is hitting the car’s static mesh (as though the car is a solid mesh, which it is not).

I have complex collision checked and the ‘camera’ channel of the car set to ‘block’. Anyone know if it is possible to run a line trace inside a mesh?

Thanks in advance!

Ant

You could do line trace by object, and set the static mesh to a different object channel that the camera is looking for.

set the objects array -> make array and put only the objects channel you want the trace to see. Then do a branch check from the line trace and do a check to see if the object hit is a specific actor and make sure that actor has the object channel the trace is looking for in the actors defaults.

Thanks for the response!

I gave that a go - same scenario basically. The vehicle has one static mesh that makes up the chassis of the car. Even though it is hollow on the inside (in the same way a real car would be), the hit is being triggered as though it is one solid object.

Note that I do want to be able to hit the cars static mesh to find the distance to the walls, but it is treating the blank space between the cars walls as a solid for the hit, if that makes sense.

Ant

Sounds like you need to make a custom collision that follows the chassis of the car. Since you are INSIDE the collision space, it is automatically hitting it.

you also may need to adjust the collision around the mesh to ignore camera/visibility.

if you have a collision component in the car actors components list, you need to work with(change the object type) for both the cars mesh collision and the collision the mesh has attached to it.

If the vehicle was a skeletal mesh you could add sockets and then get the world location of the camera, socket and then distance between. Using the same principle you can add components to the sm.

Amazing. Thanks for the feedback! This should give me enough to figure it out I think :slight_smile: