Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, 7th_zorro, dr_panther), 1,297 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rotation limits on a moving object #169866
11/28/07 08:00
11/28/07 08:00
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Hi everyone,
In my 3D battleships game, I have a turret attached to the front and back of the ship, and need to prevent them from turning too far(see pic below).

[image][/image]
This is a problem because the ship can also turn seperate of the turret and get a rotation in the thousands of degrees because it overruns the 360 degree numerical rotation value. Because of this, I can't compare the turret's rotation to the ship's rotation and limit it's rotation properly. My script is:
Code:
  
vec_set(my.pan, your.pan);
my.pan += heading;
my.pan = max(my.pan, your.pan + 70);
my.pan = min(my.pan, your.pan + 290);



How can i change this to account for the fact that the value for the ships pan may be far greater than 360 degrees?


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: Rotation limits on a moving object [Re: Impaler] #169867
11/28/07 08:42
11/28/07 08:42
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hi,

you can use ang for this.
Thus all your angles will be within the same range (-180 ... 180).

Re: Rotation limits on a moving object [Re: Fenriswolf] #169868
11/28/07 12:37
11/28/07 12:37
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Thanks, fenriswolf, I didn't know about that before


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).

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