Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Quad), 755 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
player.pan issue #453719
08/09/15 22:41
08/09/15 22:41
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
When I turn my players pan to the left, his pan is positive, (0 -> 360) if I turn to the right, his pan becomes negative (0 -> -360)

This is problem-some because I'd like to use the players pan as a trigger for particular moments, but if the player turns right a few times, his pan can become negative and thus wouldn't activate something like this

if(player.pan > 45 || player.pan < 270)...

How can I keep the players pan from going into the negatives?

I've tried player.pan %= 360;
player.pan = clamp(player.pan, 0, 360);// this only allows for left panning

Im not to sure what to do to overcome this. can someone please help me?


A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: player.pan issue [Re: DLively] #453733
08/10/15 10:00
08/10/15 10:00
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Should work:

player.pan = ang(player.pan);
if (player.pan < 0) player.pan += 360;

Re: player.pan issue [Re: Reconnoiter] #453737
08/10/15 12:12
08/10/15 12:12
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
I would recomend always using the -180<>180 range returned from ang instruction so you can take advantaje of the symmetry of the sign.

Code:
if ( abs(angle) < 45 )
   // front
else if ( abs(angle) > 135 )
   // back
else if ( angle > 0 )
   // left
else
   // right



Anyway cycle(angle,0,360); does the job.
Salud!

Last edited by txesmi; 08/10/15 12:15.

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