# How can I set direction for the Ray to check collision in front of character?

1-how can I set direction for the Ray to check collision in front of character?
2-and rotate the Ray by changing rotation of character?

i can not use camera direction because it is from Top and the game genre is RTS.

Probably easier to direct you to a conversation youâ€™ll probably have.

Could you do something like:

``````	Ray ray = new Ray(this.model.getWorldTranslation(),
model.getWorldRotation().getRotationColumn(2));
``````

This will get the direction in x/z planes (i.e. not up or down).

I know some of the tutorials do this but I think itâ€™s so much better if you guys stop using this confusing magic incantation when the simpler way is to just multiply the direction you want.

model.getWorldRotation().mult(Vector3f.UNIT_Z);

â€¦that teaches you something useful.

The rotation column BS is just magic unless you understand a whole bunch of other things about how rotation matrixes decompose into axes vectors, etcâ€¦ no need to know all of that.

â€śIf you want to know what the forward direction is for some character then multiple the general forward direction by their rotation.â€ť Which works for side direction, up direction, down direction, back direction, etcâ€¦

I really wish we could just get rid of the references to the getRotationColumn() stuff. Folks asking these super basic 3D math questions are confused enough already.

2 Likes