How rotate a vector in blueprint ?

Hi

I have an object and i would like to send rays from his world location to every direction. (It’s a kind of RayTracing).

https://image.noelshack.com/minis/2019/31/1/1564393868-1.png
(It make a cross as wanted)

Basically what i did is change the X and Y , but it’s useless … If i change the object orientation, the ray will not be sent correctly.

https://image.noelshack.com/minis/2019/31/1/1564393869-2.png

I asked my friends to help me and they talked about matrix, quarts, … I’m lost.

If you want it in every direction, maybe consider using a sphere trace?


Looking at this again, if you wanted to rotate the rays… You would need to get the **actors **location & forward vector.

Multiply the actors forward vector by an amount (distance of the ray)…

Add this new vector and the actors location together, this would become the “end” vector…

The start vector would just be the actors location.

Hope this helps!

Hi Cleava

This works for one ray…

I do the same thing. After have the inital direction, i’ll just take it and modify it… But manually like, i just change the X and Y variables of the vector…

This is my function which draw ray:
https://image.noelshack.com/minis/2019/31/2/1564455243-b.png

This is my simple algorithm:
https://image.noelshack.com/minis/2019/31/2/1564455245-c.png

Index X and Y are float that i increment, for example:

It start at 5 and at each loop i change the value, 5 to 10, 10 to 15 …

Hi Cleava, thanks for your help, I appreciate this.

This is what i want to do ! But if you change the cube rotation, the rays follows the cube ? This is my problem. If i change the rotation of my object, my rays are not sent correctly.

Please explain me how you did.

I heard that there is some raytracing included in the lights, is that true ? Can i use with others actors ?

That is a waste of CPU.
You can just cast a sphere overlap then calculate dot product to see where the hit is coming from, to check if it’s in front of character or not.

I know, hence I said

Would be best to follow Bruno’s suggestion, would be the most optimised way…

Hi. Im not really sure what i understand you problem correctly, but it looks like you just need to rotate you forward vector with object.*

*upd: or more correctly to say: rotate forward vector with some vector from object themselve, which will keep traces in correct directions.

Here’s an example. In those case traces will always “properly” oriented to objects. I.e. traces will be rotated with you object in every directions and so on. No matter how you rotate you objects, traces will in same place respectively with same rotations.

Pastebin code.

Hope that helps :slight_smile:

Hi

This is strickblack with another account … i got some error …

Thanks for your answers.

Alexander thanks for your anwser, i took your blueprint and modifief it … Thanks it helped me :slight_smile: