http://rapidsharing.com/show.php/570_new.zip
(DLL not included)
hey all,
new to irrlicht, but going along pretty good 10x to this forum!
been fiddling with this for a few days now..
my camera needs a lot of work, if any1 could recommend one of the cameras on this forum...
hmmm... physics not fully implement...
see the stupid arrow? its my biggest problem right now.
i want this to be some sort of navigational gizmo in the upper middle of the screen,
i thought i'd just child it to the camera, and make it point to a target.
doest work! maybe its my camera code..
any alternative? 10x.
Help needed , WIP included
why not look at thsi function(do some reasearch before posting plz)
core::vector3df getTargetAngle(core::vector3df v, core::vector3df r)
{
#define PI 3.14159265358979323846
//v -position
//r -target
core::vector3df angle;
float x,y,z;
x = r.X - v.X;
y = r.Y - v.Y;
z = r.Z - v.Z;
//angle in X-Z plane
angle.Y = atan2 (x, z);
angle.Y *= (180 / PI); //converting from rad to degrees
//angle.Y-=90;
//just making sure angle is somewhere between 0-360 degrees
if(angle.Y < 0) angle.Y += 360;
if(angle.Y >= 360) angle.Y -= 360;
//angle in Y-Z plane while Z and X axes are already rotated around Y
float z1 = sqrt(x*x + z*z);
angle.X = atan2 (z1, y);
angle.X *= (180 / PI); //converting from rad to degrees
//angle.X -= 90;
//just making sure angle is somewhere between 0-360 degrees
if(angle.X < 0) angle.X += 360;
if(angle.X >= 360) angle.X -= 360;
return angle;
}
core::vector3df getTargetAngle(core::vector3df v, core::vector3df r)
{
#define PI 3.14159265358979323846
//v -position
//r -target
core::vector3df angle;
float x,y,z;
x = r.X - v.X;
y = r.Y - v.Y;
z = r.Z - v.Z;
//angle in X-Z plane
angle.Y = atan2 (x, z);
angle.Y *= (180 / PI); //converting from rad to degrees
//angle.Y-=90;
//just making sure angle is somewhere between 0-360 degrees
if(angle.Y < 0) angle.Y += 360;
if(angle.Y >= 360) angle.Y -= 360;
//angle in Y-Z plane while Z and X axes are already rotated around Y
float z1 = sqrt(x*x + z*z);
angle.X = atan2 (z1, y);
angle.X *= (180 / PI); //converting from rad to degrees
//angle.X -= 90;
//just making sure angle is somewhere between 0-360 degrees
if(angle.X < 0) angle.X += 360;
if(angle.X >= 360) angle.X -= 360;
return angle;
}
well, kinda solved I guess...
i used the above function to set camera rotation, which being targeted has'nt got any of its own, hence the arrow was just sitting still.
took me while...
so:
cam->setRotation ( getTargetAngle(cam->getPosition(), cam->getTarget() );
just keep in mind that now if you arrow->setPosition(), it will translate with camera's orientation.
hope this made sense.
i used the above function to set camera rotation, which being targeted has'nt got any of its own, hence the arrow was just sitting still.
took me while...
so:
cam->setRotation ( getTargetAngle(cam->getPosition(), cam->getTarget() );
just keep in mind that now if you arrow->setPosition(), it will translate with camera's orientation.
hope this made sense.
Same same but diffrent.