Re: moving players in angles like in FPS type games

for example I think snapleft and snapright were bugged. Or maybe one of them. They are small bugs. Just you have to avoid landing on 360 degrees. For example if you ever saw if(x > 360) change it to if(x >= 360), Where x is a variable. You'll get me if you read the parts I mentioned.
Also I'm not sure if the moving function will work as expected, but here's a function you can use to move instead. It is compatible with the rotation package:
vector move(double x, double y, double z, int direction, int pitch=0)
{
vector temp;
temp.x=x+sine(calculate_theta(direction));
temp.y=y+cosine(calculate_theta(direction));
temp.z=z+sine(calculate_theta(pitch));
temp.x=round(temp.x, 2);
temp.y=round(temp.y, 2);
temp.z=round(temp.z, 2);
return temp;
}
However the vector object is kind of buggy. For example it doesn't round correctly sometimes if I can remember correctly. Here's the class I wrote to replace with bgt's vector object. If you're gonna use this, change the word "vector" to "Vector"(note the capitals), So it uses my class instead of the main vector object. It worked fine for me but it might do some bads if you're going to do something with these that I didn't do with them like adding two vectors. Here's the class anyways:
class Vector {
double x, y, z;
double None=-1;
Vector(double x=0,double y=0,double z=0)
{
this.x=x;
this.y=y;
this.z=z;
}
bool opEquals(Vector@ other)
{
return x==other.x && y==other.y && z==other.z;
}
Vector@ opAssign(Vector &in other)
{
this.x=other.x;
this.y=other.y;
this.z=other.z;
return this;
}
double& opIndex(int i)
{
if(i==0)
{
return x;
}
else if(i==1)
{
return y;
}
else if(i==2)
{
return z;
}
return None;
}
}
Oh by the way. Change the pi constant to 3.14 instead of that weird long number. Two decimles are enough.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cw via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector

Reply via email to