Hi.
I got and question that may make you laugh, it's kinda dumb, super newbish.
Let's say When a character I move (a model) reach a position when it's need a node of a plataform (I'm thinking in a 3d plataform game like mario 64) moves foward or backward or do something, some change acording to the position of some node... how do I do?
I mean should I use a library? and AI library? wich one?
Should I do it in code, seems imposible, how do I suppose to know the exact position in wich I want a change happens (you know compare the x,y,z position of the back node and the x,y,z position of the node of the character and do the change)
Or maybe should I use a invisible cube and do something related to colision detection (like when a character collides with a invisible cube in the desired position do the change)?
The last seems better but it sounds a little bit "artificial".
Anyone knows something, should I go for the invisible cube?
Thank you very much, your help is really appreciated
Events according to position
-
- Posts: 157
- Joined: Tue Mar 20, 2007 8:30 am
What you're asking is a little confusing, but if you're talking about doing something when the player reaches a certain position I can think of a few solutions.
First of all, you could use the method you touched on with the invisible cube and create a box at the place where you want the event to happen, make it invisible then check for collision with the bounding box and do the event.
Another way you could do this (and probably the one I'd use, even if it isn't the best) would be to get the players x, y and z position (core::vector3df pos = node->getPosition()) and see if they are in the range for the area you want the event to happen in. This sort of thing could be written into a function pretty easy too, it might look something like this:
The only problem with that method is that to get the min and max values would take a bit (or maybe even alot) of trial and error. Hope that helps
First of all, you could use the method you touched on with the invisible cube and create a box at the place where you want the event to happen, make it invisible then check for collision with the bounding box and do the event.
Another way you could do this (and probably the one I'd use, even if it isn't the best) would be to get the players x, y and z position (core::vector3df pos = node->getPosition()) and see if they are in the range for the area you want the event to happen in. This sort of thing could be written into a function pretty easy too, it might look something like this:
Code: Select all
bool isPlayerInPos(scene::ISceneNode playerNode, f32 minX, f32 maxX, f32 minY, f32 maxY, f32 minZ, f32 maxZ)
{
core::vector3df pos = playerNode->getPosition();
if ((pos.X > minX && pos.X < maxX) && (pos.Y > minY && pos.Y < maxY) && (pos.Z > minZ && pos.Z < maxZ))
{
return true;
}
else
{
return false;
}
}
Tell me what you cherish most. Give me the pleasure of taking it away.