A question about getCollisionPoint()

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
Andrey
Posts: 17
Joined: Sat Aug 05, 2006 6:53 pm
Location: Ukraine

A question about getCollisionPoint()

Post by Andrey »

In the example #7 we have :

Code: Select all

core::line3d<f32> line;
		line.start = camera->getPosition();
		line.end = line.start + (camera->getTarget() - line.start).normalize() * 1000.0f;

		core::vector3df intersection;
		core::triangle3df tri;

		if (smgr->getSceneCollisionManager()->getCollisionPoint(
			line, selector, intersection, tri)).....................
So, line.end here we know because the camera look at that point (camera->getTarget())..It's because here is FPS camera..

And what should I do if my camera looks not at my target? How can I get a point for my line.end? I've looked for this in help, but found nothing..or I've looked not enough carefully? Please, help.....
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Somehow you should know in which direction you are searching for triangles. But there are also other collision methods, e.g. using bounding boxes.
Andrey
Posts: 17
Joined: Sat Aug 05, 2006 6:53 pm
Location: Ukraine

Post by Andrey »

hybrid wrote:Somehow you should know in which direction you are searching for triangles. But there are also other collision methods, e.g. using bounding boxes.
But the problem is, I should specify the point on the plane. And plane has one node, therefore I should use something, that can give me back the one selected triangle of my plane...i.e., I should to determine the place on my plane, I've clicked on...
And if not this method, then what collision methods can help me?
Andrey
Posts: 17
Joined: Sat Aug 05, 2006 6:53 pm
Location: Ukraine

Post by Andrey »

I'm still having this problem..In other words:
I have one plane and it is conventional dividet into a few parts:
|---------|---------|
|.....1....|.....2.....|
---------------------
|....3.....|.....4.....|
|---------|---------|
And when I click on the plane, I want to determine, on what part of the plane I've cliked.
So, first I must to determine the "virtual" ray from camera to the plane...But I don't know, how can I find the second point for my ray if I don't use the FPS camera....

And if my english is too hard to understand, dann nochmal auf Deutsch:

Ich hab eine Flaeche, die bedingtweise in einigen Teile geteilt ist. Wie kann ich wissen, welche Teil der Flaeche angeklickt worden ist? Ich dachte, dass ich es mit der Hilfe getCollisionPoint() machen kann, aber fuer diese funktion muss ich noch einen Strahl von meiner Kamera in der angeklickten Punkt Richtung wissen. Aber wie kann ich diesen Strahl bestimmen wenn ich die FPS Kamera benutze nicht? Mit FPS Kamera kann man es sehr leicht machen : wir wissen, dass Target IMMER gleich Kursorposition ist. Aber FPS Kamera kann ich nicht benutzen! Ich weiss nicht, was ich hier machen kann...Bitte hilfen! :( :cry:
Danke.
Andrey
Posts: 17
Joined: Sat Aug 05, 2006 6:53 pm
Location: Ukraine

Post by Andrey »

:idea: 8) The answer was getRayFromScreenCoordinates() 8)
Hehe..I think, I have to learn english a little more :lol:
Post Reply