Okay so, i have 2 questions about raycasting:
- How do i raycast left/right
- How do i check if the raycast has a certain thing in it, for example if it has a part in it? Since ‘FindFirstChild’ does not work.
Thanks!!
Okay so, i have 2 questions about raycasting:
Thanks!!
What is “left/right”? Do you mean the left/right of a part?
workspace:Raycast(part.Position, part.CFrame.RightVector, raycastParams)
Raycasting returns a RaycastResult
object, which has an instance property.
Left/Right of a player/character…
workspace:Raycast(character.HumanoidRootPart.Position, character.HumanoidRootPart.CFrame.RightVector, raycastParams)
In case he is still unsure this would be for the right of the character.
Yes, i am aware that this is right, but is there anyway to check on the left? Since im unsure if there is a ‘Left Vector’
Yes, you would simply negate the RightVector to achieve the LeftVector, as in the following.
workspace:Raycast(character.HumanoidRootPart.Position, character.HumanoidRootPart.CFrame.RightVector, raycastParams)
workspace:Raycast(character.HumanoidRootPart.Position, -character.HumanoidRootPart.CFrame.RightVector, raycastParams)
To explain the LeftVector is the negative vector of the RightVector.
Hmm, this does not seem to work?
a = workspace:Raycast(plr.Character.HumanoidRootPart.Position, plr.Character.HumanoidRootPart.CFrame.RightVector, raycastParams)
It does not return ‘a’/my if statement does not go through it?
I just copied that line of code from Pokemon’s reply earlier as an example.