Re: moving players in angles like in FPS type games

2019-06-30 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

x = r × cos θy = r × sin θIf you're doing 3d:x = r × cos θ × cos φy = r × sin θ × cos φz = r × sin φAssuming that z is vertical. If not, just swap z and y.θ = rotation in the x/y plane.φ = elevation above or below the x/y plane.Both θ and φ are in radians. 1° = π/180.r is the total distance.There is a way to use rotation around each axis, but I would have to work out how it works and/or look it up.Learning the Unit Circle might be helpful, but you probably won't need anything that it'd be helpful for. Mostly, it might be helpful to remember that cos (0) = 1, cos (π/2) = 0, sin (0) = 0, and sin (π/2) = 1.If you want to get more technical, you could ditch angles and use orientation vectors. That's basically those three equations at the top, where r = 1, put into a vector, meaning it points in the direction corresponding to the angles. Ex, facing right would be (1, 0, 0), left would be (-1 0, 0), and further examples depend on how you handle y and z.Next time, I'm just writing "theta" and "phi" and "pi". UEB is annoying.

URL: https://forum.audiogames.net/post/445207/#p445207




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-30 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

Bleah, don't believe me if I'm writing calculations at 2 am. Correct result coords are 0;sqrt(2)/2;sqrt(2)/2, thus about 0;0.75;0.75, because the horizontal angle is 0 and not 45, what have I for some misterious reason thought and what made me the second power of sqrt(2)/2. Even in that case, the square root in numerator will go out and the denominator will be a nice number, concretely it would look like 2/4, what is exactly 0.5 and not 0.56.The same would happen for x axis, because sin(45)=cos(45), so if you move under angles45;45, you would end on 0.5;0.5;sqrt(2)/2, approximately 0.5;0.5;0.75.Of course it isn't very important, just a small correction from mi side, so I don't look like a bigger idiot than I actually am. The rest is okay.Best regardsRastislav

URL: https://forum.audiogames.net/post/445106/#p445106




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

Makes sense. Thanks

URL: https://forum.audiogames.net/post/445086/#p445086




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

@Kianoosh: nope.You can imagine it like moving in a ball. You are in center of a ball and want to move so you touch its side. First you need to specify the angle of point on surface of the ball toward which you want to move. Because there are three dimensions, you need two angles to do so. First, which represents your horizontal facing i.e. distance in degrees from zeroth meridian and second representing distance in degrees from the equator of ball.Gps by the way works in similar fashion.The distance from your location to that point is equal to radius of that ball. Every point from the ball's surface has the same distance from center, so if you want to move in 3d space for some distance, you know, that you'll end somewhere on surface of a ball with radius equal to distance of your movement.Vertical angles are thus 0 for horizontal, 45 half up, 90 up, 135 half up behind, 180 behind, 225 half down behind, 270 down, 315 half down and 360 is equal to zero.You can of course use every possible angle, even -785 if you like, this are just most noticeable values.If one moves under angles 0;45 degrees, 1 meter, he will end on 0;(sqrt(2)/2)^2;sqrt(2)/2.That is approximately 0;0.56;0.75.These numbers are hard to imagine, that's why I personally use the mind model of a ball.Best regardsRastislav

URL: https://forum.audiogames.net/post/445051/#p445051




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

At 6 could you explane the z angle? Like 45 is half up so if the player goes a step forward from 0 0 0 with a z angle of 45 he ends up on 0 0.5 0.5 or what? And how about half down and straight down? are they 135 and 180 degrees respectively? Thanks for the code btw

URL: https://forum.audiogames.net/post/444964/#p444964




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : cw via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

Thanks for that info. I see that the bugs talked about here are small enough for me to katch (for the most part) if I used some simple logic. Been wanting to come up with some kind of space based game for awhile. Just have not sat down and figured it out yet. Do not know why, but I see that the dev of this include felt the need to combine -= for some reason. The not having the comments hirts a bit.edit@6 Thanks for that bit of code

URL: https://forum.audiogames.net/post/444895/#p444895




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : cw via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

Thanks for that info. I see that the bugs talked about here are small enough for me to katch (for the most part) if I used some simple logic. Been wanting to come up with some kind of space based game for awhile. Just have not sat down and figured it out yet. Do not know why, but I see that the dev of this include felt the need to combine -= for some reason. The not having the comments hirts a bit.

URL: https://forum.audiogames.net/post/444895/#p444895




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

@Kianoosh: your method is slightly wrong. As well as Samtupyone, if you was just rewriting his code with better rounding, it isn't your fault.What is problem here is, that Samtupy haven't included any connection between x, y and z axis. Imagine you stand at 0;0;0 and are facing 0 degrees and 90 vertical, thus looking straight up right?Now, applying this method, z will be raised to 1, because you're looking upward. But y will also be raised by 1, because your direction is 0 degrees and your vertical angle does not influence horizontal movement in these formulas.So instead of ending on 0;0;1, one point up from the first position, you end on 0;1;1, 45 degrees vertically from your first position, what is probably not what you want.I have designed my own formulas to solve this problem, because I needed 3D movement in Blindcraft. I have posted my code on this forum some time ago. Now, here is its edited, nice version for C++, which I'm currently using:BgtVector move_3d(double x, double y, double z, double angle, double zAngle, double distance=1.0)
{
BgtVector r;
double length=distance*cos(zAngle*pi/180);
r.x=x+length*sin(angle*pi/180);
r.y=y+length*cos(angle*pi/180);
r.z=z+distance*sin(zAngle*pi/180);

return r;
}Simple and straight-forward I think, just replace BgtVector with vector and it should work in bgt as well.Just one thing to add, this method counts with x axis going from the left to right, y from behind to front, z from bottom to the sky and horizontal angle 0 representing north with 90 east, 180 south etc. and vertical angle 0 being normal angle, 90 straight up, 180 behind etc.Best regardsRastislav

URL: https://forum.audiogames.net/post/444894/#p444894




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector


  


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  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.

URL: https://forum.audiogames.net/post/444885/#p444885




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-29 Thread AudioGames . net Forum — Developers room : cw via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

@3 Math is not one of those things I am great at. Precalc is about as far as I got in math. @2 So, do you recall where the bugs are so I can have a look see? Got the includes here. Just not sure where to look or what they are yet.

URL: https://forum.audiogames.net/post/444878/#p444878




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-28 Thread AudioGames . net Forum — Developers room : redfox via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

I haven't tested this out, but I'm sure you could do it with a bit of math.Asuming you allready have a 3d map system, all you need to do when moving is incorporate degrees. This is also different if you want full 360 degree, or just set directions like north, northeast, southwest, etc.I don't know exactly how you'd go about this, but the second option seems loads easier than the first. Probably some equations to check facing and then move differently based on that.

URL: https://forum.audiogames.net/post/444829/#p444829




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: moving players in angles like in FPS type games

2019-06-28 Thread AudioGames . net Forum — Developers room : kianoosh via Audiogames-reflector


  


Re: moving players in angles like in FPS type games

You might want to check out this:http://www.samtupy.com/dev/rotation_package_1.1.zipAlthough I have to warn you that this include has a few bugs you need to fix yourself. I have the fixed versions of it around but they are for my other games and usually contain none - related code or a messy code in them.

URL: https://forum.audiogames.net/post/444820/#p444820




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector