Vector.rotate is casting rays the wrong way

Im trying to calculate the angel from a windows to top of an obstacles in my example a wall.
My problem is that my rays are comming out in a funky way. Left side the rays are going in the right direction, but the right side they are going in the wrong direction.
I guess its something with the vector.rotate node but cant figure out what wrong.

Side view

Top View

It looks like you’re rotating them all in the same direction. If you want them all to go up you’ll have to determine which are positive and which are negative.

1 Like

Rotate works kinda like a clock - only goes one way unless you travel back in time (negative angle of rotation).

Also, it may be easier to get the angle by drawing the vector once at the desired location instead of doing n calculations and seeing which is the last to Intersect the wall.

Try finding the top of the wall (or whatever object), then try finding the point on that geometry which is closest to your window’s top, then draw the vector by the two points.

yes I know but can’t figureout how to rotate it like i want to do it. have been trying for hours.
And its the only way i can think of how to messure the angle to an obstacles

If you want the angle between the imaginary line from the top of an object to another object and a level plane, which sounds easier to do in real life?

  1. Draw the line between the top of the object and your object and measure the angle between that and a plane. (One measurement from one line)

  2. Draw a line from your object at every angle possible and see which of those that connects to the top of the other object has the greatest angle. (Infinite measurements of infinite lines)

Your vectors on the left are correct and the ones on the right need to go the opposite direction. Check the X value of the initial vector with no rotation. If the X value is negative then your rotations are already correct. If the X value is positive you need to flip the angle to a negative value. You can do most of this with a simple If node or codeblock.

Thanks for the help. After a lot of try i final got i to work.

the next problem in doing a RayBounce for ever 10 degrees and after that im doing it for every 1 degrees but im getting a lot nulls in my lists that gives a lot of warning and some nodes dosent work with nulls. how can i work around that.


Did you figure out a solution to your problem?
I’m trying the same solution except it does not send the ray’s in the corresponding direction as in your example. It seems rather random…

Essentially what I’m trying to achieve is to send the rays in a 45 degree angle to each side (horizontal plane) and also up in the vertical plane (starting from horizontal)

Yes i solved it.
It was the vector.rotate that wasent set propperly. try use a line.bystartpointdirectionlenght on your vector.rotate the you can play around with the axis until you find the right one, that was how i did it.