[solved]Question about images between vectors (?)

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
paulorr29
Posts: 27
Joined: Fri Aug 27, 2010 8:23 pm
Location: Panama
Contact:

[solved]Question about images between vectors (?)

Post by paulorr29 »

Hi !!!! a question, really i dont know the name of my question, but i trying to make an images titles for a town .
so, if the player is between 2 point of the vector 3d ( x,y,z ) , the image makes true ( visible ) and outside the points of vector 3d, the image makes false.
but really, i dont know how find answers of my question in search

i have a little idea, but i dont know
if player.x > terrain && player.x < terrain
image1=true;
else
image1=false;

the part of terrain, is the part, that i dont know how to write
any help, how to write the vector ? a little example plz

or if you know other method, to make my idea, tell me :) !!!

greetings
Last edited by paulorr29 on Wed Oct 13, 2010 3:33 pm, edited 1 time in total.
my first app with irrlicht http://youtube.com/watch?v=8OHUgciBT8E
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Post by REDDemon »

it seems you are speaking about a portal culling... or looking at your demo you have only to detect if you go trought a line as the finish line of a race game.

if you are referring to the finish line you can just check if the player is inside a quad. and place the quad in the end of your race game

you have 4 points and you must check if

P(x1,y1)
P(x2,Y2)
P(x1,Y2)
P(x2,Y1)

y2x1 y2x2


y1x1 y1x2

if (player.x < x2) && (player.x >x1)
if( player.y <y2) && ( player.y > y1)
finish line!

it is the simplest solution i think. if not explain better your problem :)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
paulorr29
Posts: 27
Joined: Fri Aug 27, 2010 8:23 pm
Location: Panama
Contact:

Post by paulorr29 »

oks, thanks !!!!
i dont know what happened to me, my mind crashed hahaha
but yes, something like the line finish race

in my case, the town, when the player enter the town, the title appears

if (playerpos.X > 2000 && playerpos.Z >6000)
title[1]=true;
else
title[1]=false;


thanks !!!! solved , working now :D
my first app with irrlicht http://youtube.com/watch?v=8OHUgciBT8E
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

the rectangle classes have a ContainsPoint(point) function. you could calculate the bounds around your town and then use that.

point playerpos(10,10);
rect town1(0,0,100,100);
rect town2(0,101,101,200);
rect enchantedforest(400,300,480,310);

if (town1.containpoint(playerpos)) then do something
else
if (town2.containpoint(playerpos)) then do something different
else
if (enchangedforest.containpoint(playerpos)) then do something different


now, in the end, I would just create a trigger class and maintain a list of them to be iterated through and send messages based upon player position, but that is just me :)

triggerlist.addTrigger("Town1",rect(0,0,100,100);
triggerlist.addTrigger("Town2",rect());
triggerlist.addTrigger("EnchantedForest",rect());

while (!over)
{
stringc location = triggerlist.getContacted(playerpos);
if (location != "NONE")
{
if (location == "Town1") then do something...........
}
}


or something like that...............
Seven
paulorr29
Posts: 27
Joined: Fri Aug 27, 2010 8:23 pm
Location: Panama
Contact:

Post by paulorr29 »

Thanks!
That will help!

greeting :D
my first app with irrlicht http://youtube.com/watch?v=8OHUgciBT8E
Post Reply