Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
0 registered members (), 938 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with *time #144141
07/28/07 20:42
07/28/07 20:42
Joined: Nov 2006
Posts: 193
England
RyuShinji Offline OP
Member
RyuShinji  Offline OP
Member

Joined: Nov 2006
Posts: 193
England
my block did rotate 90 degrees... i timed my.a_tilt to reach 90 when ab_tilt (bone.tilt) reached 90 degrees then the funcion would break; and the block would be at 90 degrees

while(1)
{
if(a_tilt == 90)
{break;}

my.ab_tilt =-10;
my.x +=7.5;
my.a_tilt +=10;

im using ent_bonerotate(my,"bone",vector(my.ab_pan, my.ab_tilt, my.ab_roll));


then i added *time like this


while(1)
{
if(a_tilt == 90)
{break;}

my.ab_tilt =-10*time;
my.x +=7.5*time;
my.a_tilt +=10*time;

but now i have to change ab_tilt == 90 to ab_tilt > 90 because it didnt break;
and not the out come of the block angle is random from 90 to 100 degrees

[QUESTION]

1.is there anyway to stop this?

2. if not, is there a way to snap the block to the nearest 90 degree angle

i.e
if outcome is 80 degrees snap to 90 degrees
if outcome is 100 degrees snap to 90 degrees
if outcome is 160 degrees snap to 180 degrees
if outcome is 470 degrees snap to 450 degrees
if outcome is -160 degrees snap to -180 degrees

could anyone please help me...

Re: Problem with *time [Re: RyuShinji] #144142
07/28/07 22:39
07/28/07 22:39
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
First you shouldn't use time. Use time_step or time_frame instead depending on your needs.

Snapping the blocks degrees is quite easy:

my.pan -= (my.pan % 90);


Always learn from history, to be sure you make the same mistakes again...
Re: Problem with *time [Re: Uhrwerk] #144143
07/29/07 05:44
07/29/07 05:44
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
just make sure a_tilt doesn't pass 90...

Code:

while(a_tilt != 90)
{
my.ab_tilt -= 10 * time_step;
my.x += 7.5 * time_step;
my.a_tilt = min(my.a_tilt + 10*time_step, 90);
}



I didn't limit the other vars, because you didn't specify their limits


xXxGuitar511
- Programmer

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