Mathematical Scripting Help

Sorry if I misunderstood, but you could get the LookAt from the tree to the character (it gives the direction of where the character is originating from the tree) and then manipulate the result LookAt direction twice to give a left and right of the tree.

From this perspective, the tree’s left and right would be inverted to the player, it’s not an obstacle just simply keep that in mind and write your code accordingly.

Now, how you find the left and right lookvectors of your LookAt is a bunch of balony, so I’m going to have to send you to another post made by a much more experienced man. Skip the Vector3:Dot() section and read all about Vector3:Cross. I’ll also attach some sample code I cooked up, but it probably won’t help in your case.

local lookVector = ...-- Your lookat value (Vector3)

local rightVector = lookVector:Cross(Vector3.new(0, 1, 0))
local leftVector = -rightVector -- oposite of right (left)
2 Likes