Hello,
I have a concept with simple camera for even more simple rts. And I don't know how to calculate point on surface xy for z = 0.0.
Let's set camera on position (0,0,10) looking at (0,0,0). How to find point on surface xy using clicked dir vector (ray) and maybe looking direction vector?
Picking for rts
Re: Picking for rts
You can use the plane3d class from Irrlicht. Your surface is a plane with normal pointing upwards (often upwards is y, but it seems you use z as upwards - which is also fine). The plane class has then intersection functions to find that point you are looking for.
Some useful functions for similar stuff can also be found in ISceneCollisionManager which you get from the scenemanager.
Some useful functions for similar stuff can also be found in ISceneCollisionManager which you get from the scenemanager.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Picking for rts
Thank you so much! plane3d is exacly what I needed
Last edited by mezdej on Sun Jun 22, 2014 5:16 pm, edited 1 time in total.