Log in
Search
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.Finding a point relative to the x, y, and z angle?
5 posters
:: Game Making :: Game Maker Help :: Game Dev. Q&A :: 3d game help
Page 1 of 1
Finding a point relative to the x, y, and z angle?
I’m having some difficulty in my game, http://www.yoyogames.com/games/show/87836 . I can’t figure out how to shoot,find a point,from a particular part off the plane. If you look at my game you will see that I can rotate my plane in all 3 dimensions; x,y,and z. I’m wonting to be able to shoot from the wings, but the x, y, and z of the bullet is always changing do to the angle of my plane. If I were to do this in 2D it would look like this.
- Code:
bulletx=x-sin(+degtorad(-direction))*(31)
bullety=y+cos(-degtorad(-direction))*(31)
- Code:
bulletx=x+???
bullety=y+???
bulletz=z+???
- Code:
bulletx=x-sin(+degtorad(-direction))*(31)
bullety=y+cos(-degtorad(-direction))*(31)
bulletz=z-cos(+degtorad(-z_direction))*(31)
Re: Finding a point relative to the x, y, and z angle?
"code databse" but this is a 3d question and "code databse" is for posting code
Re: Finding a point relative to the x, y, and z angle?
gogame1315 wrote:"code databse" but this is a 3d question and "code databse" is for posting code
You are right, but you should add the bit of 2d code that you said you knew to the code database. I personally have no knowledge of 3d gamemaking, sorry.
Re: Finding a point relative to the x, y, and z angle?
That little bit of 2d code was just to try and explain what I wonted in 3d (it was a 2d version of what I wonted in 3d) can I keep it ?-js1210- wrote:gogame1315 wrote:"code databse" but this is a 3d question and "code databse" is for posting code
You are right, but you should add the bit of 2d code that you said you knew to the code database. I personally have no knowledge of 3d gamemaking, sorry.
Re: Finding a point relative to the x, y, and z angle?
um...Yeah you can keep this topic the same as it is now. There are several people here that know about 3d. You might get an answer in a day or two.
Re: Finding a point relative to the x, y, and z angle?
If you ONLY want to rotate a point along ONE axis but around TWO rotations, you can do this:
X = x + cos(pi/180*direction)*cos(pi/180*zdirection);
Y = y + sin(pi/180*direction)*cos(pi/180*zdirection);
Z = z + sin(pi/180*zdirection);
This ONLY works when you wish to rotate point (0, 0, 1) around(direction, zdirection). If you want to rotate the point (, , ) around (xrot, yrot, zrot), you must learn matrixes and vectors, which I can't teach you. You should learn U3D for these, as it's really simple there.
EDIT:
To make the bullets come from the wings, it's still possible, but it's not going to be easy. I suggest you take a look at U3D for these functions, if you haven't already gotten too far with your game. You must re-do most of the game if you wish to switch, but it's worth it.
X = x + cos(pi/180*direction)*cos(pi/180*zdirection);
Y = y + sin(pi/180*direction)*cos(pi/180*zdirection);
Z = z + sin(pi/180*zdirection);
This ONLY works when you wish to rotate point (0, 0, 1) around(direction, zdirection). If you want to rotate the point (
EDIT:
To make the bullets come from the wings, it's still possible, but it's not going to be easy. I suggest you take a look at U3D for these functions, if you haven't already gotten too far with your game. You must re-do most of the game if you wish to switch, but it's worth it.
Hepolite- GameML Noob
- Posts : 23
Points : 54517
GameML Reputation : 12
Join date : 2009-06-03
Age : 31
Location : Land far, far away from the land far, far awaay
Re: Finding a point relative to the x, y, and z angle?
YAY.........!! It works! I have spent hours on this! how ever did you figure it out ? thanks Hepolite !
Re: Finding a point relative to the x, y, and z angle?
Yeah, U3D is a 3D rendering DLL for GM. It also has some mathematical functions, such as matirxes and vectors.
Believe me, it took a a long time to understand this. I had no background knowlegde of trignometry before I came up with that, so it wasn't easy.
No problems, by the way
Believe me, it took a a long time to understand this. I had no background knowlegde of trignometry before I came up with that, so it wasn't easy.
No problems, by the way
Hepolite- GameML Noob
- Posts : 23
Points : 54517
GameML Reputation : 12
Join date : 2009-06-03
Age : 31
Location : Land far, far away from the land far, far awaay
Re: Finding a point relative to the x, y, and z angle?
lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan (not that I don’t use them ) what grade do they teach trig, I need to know it.
Re: Finding a point relative to the x, y, and z angle?
gogame1315 wrote:lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan (not that I don’t use them ) what grade do they teach trig, I need to know it.
Senior in High School
Re: Finding a point relative to the x, y, and z angle?
NOOOOooo..... ! ! are you telling me the truth ?-js1210- wrote:gogame1315 wrote:lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan (not that I don’t use them ) what grade do they teach trig, I need to know it.
Senior in High School
Re: Finding a point relative to the x, y, and z angle?
I learned this fully out when I started at college (1st year), but I started to learn about these myself while in high school (2nd year) (I don't know if I got the school terms correct, not a native English speaker).
I don't know how you school system works, but you may not learn about this until college. You should research this on Wikipedia if you want to learn about sine, cosine and tangent.
I don't know how you school system works, but you may not learn about this until college. You should research this on Wikipedia if you want to learn about sine, cosine and tangent.
Last edited by Hepolite on Sat Jul 11, 2009 6:23 pm; edited 1 time in total
Hepolite- GameML Noob
- Posts : 23
Points : 54517
GameML Reputation : 12
Join date : 2009-06-03
Age : 31
Location : Land far, far away from the land far, far awaay
Re: Finding a point relative to the x, y, and z angle?
good ideaHepolite wrote:I learned this fully out when I started at college (1st year), but I started to learn about these myself while in high school (2nd year) (I don't know if I got the school terms correct).
I don't know how you school system works, but you may not learn about this until college. You should research this on Wikipedia if you want to learn about sine, cosine and tangent.
Re: Finding a point relative to the x, y, and z angle?
it's almost that simple.
it looks like you have 2 angles. i think this will create a bullet in front of your plane.
i had a topic about vectors. i can't find it. this site has too many sub levels.
it looks like you have 2 angles. i think this will create a bullet in front of your plane.
i had a topic about vectors. i can't find it. this site has too many sub levels.
- Code:
var dx,dy,dz,m;
dx=-sin(degtorad(-direction))*(31);
dy=cos(degtorad(-direction))*(31);
dz=-tan(degtorad(-z_direction))*(31);
m=sqrt(sqr(dx)+sqr(dy)+sqr(dz));
dx/=m;
dy/=m;
dz/=m;
with(instance_create(0,0,obj_bullet))
{
x=other.x+dx;
y=other.y+dy;
z=other.z+dz;
}
slayer 64- GameML Noob
- Posts : 20
Points : 54185
GameML Reputation : 8
Join date : 2009-07-05
Age : 34
Re: Finding a point relative to the x, y, and z angle?
thanks "slayer64" I looked for your topic and found it https://gameml.forumotion.com/gamemaker-techniques-f32/why-use-vectors-t233.htm
Similar topics
» The point of GML
» i need help finding this thing!
» Point to mouse with lite.
» turn object to a point
» Listens to Mr. Jin and Yogi Ceramic sunglasses store that nothing new point
» i need help finding this thing!
» Point to mouse with lite.
» turn object to a point
» Listens to Mr. Jin and Yogi Ceramic sunglasses store that nothing new point
:: Game Making :: Game Maker Help :: Game Dev. Q&A :: 3d game help
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|