Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, 7th_zorro, 1 invisible), 890 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: joy force [Re: MrGuest] #384003
09/28/11 02:06
09/28/11 02:06
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
yep, its werid but it works! =P with "-90" the player kept spinning around non stop, and with "-0" it works. i also tried "0" but then it just didnt turn.

Re: joy force [Re: Funeral] #384120
09/29/11 14:17
09/29/11 14:17
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Ah now I see my fault, sorry for this.
The -= 90 offset should only be executed if the angle was updated, this I did not consider.
I'd suggest this code:
Code:
VECTOR forceVec; // our vector we will set depending on joy_force and use for rotation - global definition or local but not in a loop!
var forceThreshold = 0.1; // our threshold value, adjust this if needed
...
// in the function:
vec_set(forceVec, nullvector); // reset our forceVec

if(abs(joy_force.x) > forceThreshold)
{
    forceVec.x = sign(joy_force.x);
}

if(abs(joy_force.y) > forceThreshold)
{
    forceVec.y = sign(joy_force.y);
}

if(vec_length(joy_force) > 0) // any change?
{
    vec_to_angle(my.pan, forceVec);
    my.pan -= 90; // remove this line if no offset needed
}



Re: joy force [Re: Xarthor] #384163
09/30/11 00:18
09/30/11 00:18
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
thx! yes its solved now :), hmm but another problem came up, now: its a 3d person, and when i rotate the camera(pan angle) the player's doesnt adjust to the screen and it takes the x axis the right of the screen, so if i move the joystick forward the player turns and walk to the right.. should i ask here or make a new post?

Re: camera dependent movement [Re: Funeral] #384176
09/30/11 08:19
09/30/11 08:19
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
So you want the move directions of the character to be dependent on the angle of the camera?

When the player moves the character forward and while moving changes the camera angle, should the character automatically adapt to this change (means rotate too) or should he keep moving the direction he had before rotating the camera?

Last edited by Xarthor; 09/30/11 08:19.
Re: camera dependent movement [Re: Xarthor] #384230
09/30/11 23:54
09/30/11 23:54
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
see, its for a 3rd person game like super mario, so when i move the joystick forward it moves forward, but when i rotate the camera's pan angle and i move the joystick forward the player keeps going to the same direction as before.
i mean the X axis has to change automaticly to adjust to the joystick movements.

for insteance if i rotate the camera 90º, the player goes to the right when i move the joystick forward.

hmm dunno if i was clear enough...

Re: camera dependent movement [Re: Funeral] #384479
10/03/11 18:32
10/03/11 18:32
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
and that's pretty much the whole thing... and it doesnt work just by using relative speed in c_move

Re: camera dependent movement [Re: Xarthor] #390182
12/23/11 19:32
12/23/11 19:32
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
Originally Posted By: Xarthor
So you want the move directions of the character to be dependent on the angle of the camera?

When the player moves the character forward and while moving changes the camera angle, should the character automatically adapt to this change (means rotate too) or should he keep moving the direction he had before rotating the camera?


first option laugh

Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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