Getting a point at certain distance from where I'm looking

If I wanted to find the location of a point at an arbitrary distance away from myself, relative to the direction I’m looking, how would I do it? In UDK I used

End = ViewPointVector + normal(vector(ViewPointRotation))*Dsitance;

This will probably do it:

viewVector = base.render.getTransform(base.camera).getMat().xform(base.camLens.getViewVector())
end = base.camera.getPos(render) + viewVector * distance

It might be that you have to swap render and camera in the first line, I always forget in which order they belong :smiley:

Thanks, that helped a lot.

Or just:

render.getRelativePoint(base.cam, (0, distance, 0))

Well yeah, but that’d be too easy :stuck_out_tongue:

That’s useful for the future.

But I think I need to implement it the hard way. I have

        view_vector = base.render.getTransform(base.camera).getMat().xform(base.camLens.getViewVector())
        end = base.camera.getPos(render) + Vec3(view_vector[0], view_vector[1], view_vector[2]) * 5

This returns a point, but not the one directly 5 units away from the camera view. How do I fix that?

Hm, I just tested it, it works for me. How do you know its not the point you are looking for?