Download

Vector Math

Hi I need to calculate the normal vector of a given actor (just surfaces like walls or floors) without using raycasts. How can I do it? I saw I need to do the dot product from 2 vectors of the surface but how can I find them? And also dot product is a float but I want the vector so how can I obtain it?

Thanks in advance

I think more information is needed on what exactly you’re trying to do in order to be able to better answer your question. A normal vector on a static mesh is easy to achieve via raycast hit from a mouse if for example, you were trying to dynamically place buildings/furniture/whatever in a game like an RTS or the Sims.

Unless you’re talking about a moving object? Which in case the vector would be the direction in which it is moving? Or do you want the forward vector which is the direction it is facing? A dot product is used to find the length of a vector or the angle between two vectors, which is what I mostly use it for, such as the angle amount difference from the direction the player is looking, to the direction of which the player is moving, in order to gradually slow the player down the more he is closer to walking backwards.

But yeah, you’re question is confusing without knowing what you are trying to do and more specifics are required.

A vector is literally just a structure of 3 floats, which can be used to determine x,y,z location, what direction an object is facing, or even what RGB color it is.

well I’m trying to find the normal vector of an overlapped static mesh so for example I have a BP with an overlapping component and I want to find the normal vector of that static mesh which is overlapping with my BP. Could you tell me how to set correctly the line trace to make it face the overlapped static mesh so that I can use Hit Normal Pin from line trace function?