Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,280 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Player rotation doesn't work #386050
10/27/11 15:13
10/27/11 15:13
Joined: Oct 2011
Posts: 21
O
oODarkPassionOo Offline OP
Newbie
oODarkPassionOo  Offline OP
Newbie
O

Joined: Oct 2011
Posts: 21
Hello,

i have a problem laugh

Code:
if(mouse_right == 1)
   	{
         vec_set(temp.x, mouse_pos.x);
   	 vec_set(temp.y, mouse_pos.y);
         vec_sub (temp.x, player.x);
         vec_to_angle (my.pan, temp);
         vec_rotate(temp, my.pan);
   	}



ok thats the snipet.
On a right mouse click or on hold the right mousebutton the player should rotate to/or with the mouse cursor.

So now if i pressed the right mousebutton the player rotates to the north maximum 90°. why?
he should rotate 360°.

Ok i am not really understand the vector thing but maybe anyone have an idea and could help me please.

I hope you understand my bad english laugh

Thanks a lot

oODarkPassionOo


Last edited by oODarkPassionOo; 10/27/11 15:27.
Re: Player rotation doesn't work [Re: oODarkPassionOo] #386080
10/27/11 20:31
10/27/11 20:31
Joined: Oct 2011
Posts: 21
O
oODarkPassionOo Offline OP
Newbie
oODarkPassionOo  Offline OP
Newbie
O

Joined: Oct 2011
Posts: 21
Ok after 9 hours the movement does work but not correctly.

http://www.youtube.com/watch?v=xEnf0UkSm2w

in this video you can see that the bullets not in a line with the mouse cursor.
So it is very difficult to hit the red ghost laugh

I think you see what i mean.
How can i fix that?

Code:
if(mouse_right == 1)
{   		
   my.pan = (mouse_pos.x) * 0.75 * time_step;
   		
   vec_set(camera.x, vector(0, 0, 0)); 
   vec_rotate(camera.x, my.pan); 
   vec_add(camera.x, my.x); 
   vec_set(camera.pan, vector(my.pan, 0,0)); 
   my.pan +=180; 
}



ok i don't understand that vector-thing and i am very thankful when anyone could explain it to me or correct the codesnipet for me.

i looked in many forums and tested some code like that above.

Thank you

oOdarkPassionOo

Last edited by oODarkPassionOo; 10/27/11 20:35.
Re: Player rotation doesn't work [Re: oODarkPassionOo] #386083
10/27/11 22:37
10/27/11 22:37
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
You want the player to face a goal on his ground where he moves around.
But, the mouse cursor moves within the plane of the screen.
That are two unrelated positions, to get them 'in touch' you have to transform the position of the mouse from the screen to the surface of the ground.
The snippet of the manual shows how to do that.
http://www.conitec.net/beta/mouse_pos3d.htm
Then you can let the player turn in direction of that position on the ground with
the following snippet from the manual:
http://www.conitec.net/beta/avec_to_angle.htm

Re: Player rotation doesn't work [Re: Pappenheimer] #386093
10/28/11 07:02
10/28/11 07:02
Joined: Oct 2011
Posts: 21
O
oODarkPassionOo Offline OP
Newbie
oODarkPassionOo  Offline OP
Newbie
O

Joined: Oct 2011
Posts: 21
Huhu,

danke erstmal für die Erklärung, soweit kann ich folgen.
Aber leider klappt das noch immer nicht so wie ich das gerne hätte. Anscheinend fehlt mir da der Teil im Gehirn der für Vektoren bestimmt ist laugh

Ich probiers auf deiner Grundlage mal weiter und vllt schaff ich es dann irgendwann obwohl es echt frustrierend sein kann aber das gehört ja dazu.

Lg


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1