Picking for rts

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mezdej
Posts: 4
Joined: Thu Apr 21, 2011 12:54 pm

Picking for rts

Post by mezdej »

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?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Picking for rts

Post by CuteAlien »

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.
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
mezdej
Posts: 4
Joined: Thu Apr 21, 2011 12:54 pm

Re: Picking for rts

Post by mezdej »

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.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Picking for rts

Post by Seven »

Post Reply