[SOLVED]Using ViewDirection to cast rays from one side to another

Hey guys,

I’ve been using one ray for my characters up till now plotting directly in the view direction of the player. However I want to develop this in to a line of sight whereas it’s cast more like a cone. I’d like to offset the rays from left to right for something such as: | / all coming from the same origin.

I’m unsure of how to do this, I messed about with simple calculations but got nothing to work so far.

Keeping the ray in the right direction whilst the players direction changes just goes all over the place as I rotate to certain points.


Thanks, slides helped a tonne.

Different problem yet same sort-of vector issue so I’ll keep it to this thread.

If I were to have two location vectors, VectorA and VectorB. VectorA being the bot, VectorB being the waypoint.

How would I rotate VectorB so that it would rotate based on the distance from VectorA instead of rotating on its own axis (if I’m saying this right).

In other words, I want the waypoint to end up behind the bot in the same distance it was in front.

You could subtract VectorA from VectorB then rotate that resulting vector and then add VectorA back in.

Aha! that’s where I was going wrong :slight_smile: I was forgetting to add VectorA, cheers :smiley: