Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!

Join the forum, it's quick and easy

Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com

Finding a point relative to the x, y, and z angle?

5 posters

Go down

Finding a point relative to the x, y, and z angle? Empty Finding a point relative to the x, y, and z angle?

Post by gogame1315 Fri Jul 10, 2009 7:19 pm

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)
But in 3d I have z
Code:
bulletx=x+???
bullety=y+???
bulletz=z+???
its not as simple as adding the third dimension
Code:
bulletx=x-sin(+degtorad(-direction))*(31)
bullety=y+cos(-degtorad(-direction))*(31)
bulletz=z-cos(+degtorad(-z_direction))*(31)
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by 3d Fri Jul 10, 2009 7:25 pm

move to the code databse section
3d
3d
Admin
Admin

Posts : 1227
Points : 66206
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Fri Jul 10, 2009 7:30 pm

"code databse" but this is a 3d question and "code databse" is for posting code Question
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by -js1210- Fri Jul 10, 2009 7:34 pm

gogame1315 wrote:"code databse" but this is a 3d question and "code databse" is for posting code Question

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. Sad
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56572
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by 3d Fri Jul 10, 2009 7:36 pm

oh sorry. clown
3d
3d
Admin
Admin

Posts : 1227
Points : 66206
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Fri Jul 10, 2009 7:41 pm

-js1210- wrote:
gogame1315 wrote:"code databse" but this is a 3d question and "code databse" is for posting code Question

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. Sad
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 ?
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Fri Jul 10, 2009 8:01 pm

Oh good. Very Happy
So I don’t have to edit my post. Surprised
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by -js1210- Fri Jul 10, 2009 8:15 pm

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.
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56572
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Fri Jul 10, 2009 8:19 pm

Good thank Very Happy
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by Hepolite Sat Jul 11, 2009 8:52 am

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.
Hepolite
Hepolite
GameML Noob
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

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by 3d Sat Jul 11, 2009 8:58 am

Woah.
3d
3d
Admin
Admin

Posts : 1227
Points : 66206
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 11:21 am

Wow ! Shocked what is U3D, is it a DLL for 3d ?
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 11:56 am

YAY.........!! Very Happy Very Happy It works! I have spent hours on this! how ever did you figure it out ? thanks Hepolite !
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by Hepolite Sat Jul 11, 2009 1:35 pm

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 Wink
Hepolite
Hepolite
GameML Noob
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

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 2:14 pm

lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan Sad (not that I don’t use them Cool ) what grade do they teach trig, I need to know it.
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by -js1210- Sat Jul 11, 2009 2:33 pm

gogame1315 wrote:lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan Sad (not that I don’t use them Cool ) what grade do they teach trig, I need to know it.

Senior in High School Razz
-js1210-
-js1210-
Super 500 GML
Super 500 GML

Posts : 1298
Points : 56572
GameML Reputation : 27
Join date : 2009-06-02
Age : 29
Location : United States

http://www.yoyogames.com/members/js1210

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 3:36 pm

-js1210- wrote:
gogame1315 wrote:lol. I’m in grade 7 so I don’t even know the functions cos, sin, and tan Sad (not that I don’t use them Cool ) what grade do they teach trig, I need to know it.

Senior in High School Razz
NOOOOooo..... ! ! Sad Crying or Very sad Mad are you telling me the truth ? Sad
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by Hepolite Sat Jul 11, 2009 3:45 pm

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.


Last edited by Hepolite on Sat Jul 11, 2009 6:23 pm; edited 1 time in total
Hepolite
Hepolite
GameML Noob
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

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by 3d Sat Jul 11, 2009 3:49 pm

I know cos(ine) not much else, and trig.
3d
3d
Admin
Admin

Posts : 1227
Points : 66206
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 3:52 pm

Hepolite 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.
Sad good idea Very Happy
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by 3d Sat Jul 11, 2009 4:01 pm

ok
3d
3d
Admin
Admin

Posts : 1227
Points : 66206
GameML Reputation : 66
Join date : 2009-05-31
Age : 41
Location : U.S.A

https://gameml.forumotion.com

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by slayer 64 Sat Jul 11, 2009 5:32 pm

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.
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
slayer 64
GameML Noob
GameML Noob

Posts : 20
Points : 54185
GameML Reputation : 8
Join date : 2009-07-05
Age : 34

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by gogame1315 Sat Jul 11, 2009 6:26 pm

thanks "slayer64" Smile I looked for your topic and found it https://gameml.forumotion.com/gamemaker-techniques-f32/why-use-vectors-t233.htm
gogame1315
gogame1315
GameML Adventurer
GameML Adventurer

Posts : 103
Points : 56235
GameML Reputation : 10
Join date : 2009-07-10
Age : 28

http://www.yoyogames.com/members/gamesgo1315

Back to top Go down

Finding a point relative to the x, y, and z angle? Empty Re: Finding a point relative to the x, y, and z angle?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum