Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 4 1 2 3 4
Re: Elevator cable [Re: Frits] #74514
05/28/06 15:10
05/28/06 15:10
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
At last I have tried out the groing and shrinking cable.
I have after a couple of hours still no success in altering the size of the cable, it does some verry odd things.
I try to explain the problem:



The action for the cable;

Code:

action cable_act
{
while(me != null)
{
if (key_d) // down
{
me.scale_z+=speed*time;
}
if (key_u) //up
{
me.scale_z-=speed*time;
}
wait(1);
}
}



I have set the base of the cable in MED at the top (see A).
I have positioned it in a test level (see B) so the fixed point is at the blue and red arrow.
When I push on d, first the cable doubles in leghts and then it shrinks at the fixed point (see C green arrow).
When I push on u, first the complete cable jumps up, doubles in lengths and then it shrinks again at the fixed point (see D green arrow).

If I set the base in MED at the bottem and rotate the cable in the test level then the cable double in lenghts and grows when I push d or u!

Can some one help me, because I don't know how to go on with this behaviour.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74515
05/28/06 18:09
05/28/06 18:09
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
first advice:
scale is very sensitive. A scale of 1 = 100%, and 2 = 200%.
Your increasing the scale_z value to quickly. Make sure your speed value is very low; less than 1! like "speed = 0.01;"...

Second:
Actually thats the only thing i could think of...


xXxGuitar511
- Programmer
Re: Elevator cable [Re: xXxGuitar511] #74516
05/29/06 05:34
05/29/06 05:34
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Hi Frits,

You may lower the speed value and keep the scale_z value
to 1 in order to prevent it jumps up.

Code:

var speed = 0.1; // play with it

if (key_u && my.scale_z > 1)
{
me.scale_z-=speed*time;
}



Re: Elevator cable [Re: vlau] #74517
05/29/06 06:07
05/29/06 06:07
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
Also, position the model cables so that the very top of them is exactly on the Z-axis and everything below it. Then just attach the cables to the cable I made for you earlier. For best results, keep the cable short. The longer the cable, the more "touchy" it gets and the less precision you'll have. If you have the cable initially 16 quants tall, and set the scale factor to 8, the cable would be 128 quants. If it was initially 128 quants tall, it'd be 1024 quants tall. The smaller, the greater the precision you can have. If you want extreme precision, just use a side variable going from 0 to 1,000,000 then divide by some factor to get the extreme-precision cable size, but even with this, a shorter cable would give better results.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: Elevator cable [Re: ulillillia] #74518
05/29/06 12:12
05/29/06 12:12
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Hi guys,
Thanks for your solutions, now I understand how the scale thing works.
Indead my scale factor was way to big.

Testing this I found the following;
scale factor depents on initial length and the length after expanding or shrinking.

I made a test elevator which goes up/down 104 quants with a speed of 3*time.
The initial cablelength for the lift is 212 quants, end lenghts is 108 quants.
After trying I got a scalefactor of 0.018 (*time).
The initial cablelength for the contraweight is 108, end length 212.
Here I found a value of 0.03 (*time).

Following question comes to my mind, is it possible to make a sort of formula to determine the scale factor to be used? I am not a mathematician so I have to try different values for that factor. If I change the initial lenth I have to expiriment with the scalefactor again.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74519
05/29/06 13:11
05/29/06 13:11
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
The formula depends on the length of your cable. In short:

cable_length * scale_factor = final_cable_length

If the original cable is 108 quants and the scale factor is 2.5, the final cable length, how long it would actually be, is 108*2.5 or 270 quants. It's a very simple formula - at the elementary level. This is also why I suggested using a cable that is much shorter so you have enhanced accuracy.

Edit: with the scale change of 0.018, the scale factor would change by 0.017578125 per tick or 0.28125 per second (16 ticks make one second). Plug this into the formula, a cable at 108 quants will change length by 30.375 quants every second. If you use a 16 quants to 1 foot map scale, this is almost 2 feet per second which is about 1.3 mph. That's rather slow for an elevator, except old ones. For big buildings, about 20 mph is the norm (estimated) which is roughly 15 times faster.

Last edited by ulillillia; 05/29/06 13:15.

"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: Elevator cable [Re: ulillillia] #74520
05/29/06 14:23
05/29/06 14:23
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Quote:

cable_length * scale_factor = final_cable_length



That is verry obvious, I think it is a little more complex than that.
There are two cables with both a different scale change and how to implement the speed of the elevator (this example has short cables, but when I use longer cables the time will alse get longer).
If I am wrong please tell me how to make the formula complete.

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74521
05/29/06 14:43
05/29/06 14:43
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
First, make both cables exactly the same length. This ensures the change is linear. Duplicate cable A and cable B and position them as needed.

Next, establish the total length of each cable. That is, the total length of the cable on the left side (with the counterweight) and the total length of the cable on the right side (with the elevator) are added up. This is your actual cable length.

Then, apply this formula to find the maximum scale factor to use:

total_cable_length / cable_unscaled_height = max_scale_factor

If the total length of the cable was 1000 quants and the unscaled height (scaling of 1) was 100 quants, the maximum scale factor you'd use is 10. If the cable's unscaled height was just 1, you'd have 100 times the precision and 1000 for the maximum scale factor.

Finally, set the scaling for one of the cables as from the time. The other cable's scaling is set as follows using yet another very simple formula:

max_scale_factor - first_cable_scale_factor = second_cable_scale_factor



That's all there is to it. It's relatively simple, but does require some skillful thinking.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Re: Elevator cable [Re: ulillillia] #74522
05/29/06 15:37
05/29/06 15:37
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Quote:

Finally, set the scaling for one of the cables as from the time.




English is not my native tongue, please explain.


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74523
05/29/06 15:48
05/29/06 15:48
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
ulillillia Offline
Senior Expert
ulillillia  Offline
Senior Expert

Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
What I mean by this is that, for one of the cables of your elevator (pick one, it doesn't matter which one), do your speed calculations on. What is your map scale? 16 quants to 1 foot?

For this, just go:

my.scale_z += 0.3*time;
you.scale_z = scale_limit - my.scale_z;

The you.scale_z refers to the other cable. Scale_limit is determined through the second step in my previous reply, the max_scale_factor value. I haven't worked with the you entity yet, only the my entity, of which is assigned to the object in focus so correct this if I don't have it set up properly.

For the value being multiplied by the time variable, I need to know the map scale you have (x quants is y units where units is either feet, meters, inches, something) and the unscaled size of your elevator cable. I also need to know just how fast you want the elevator to go up and down (10 mph? 20 km/h? 4 m/s?). From this information, I can then work out a very high-precision scale adjustment factor and get the "0.3" part to whatever is needed for the greatest precision.


"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip My 2D game - release on Jun 13th; My tutorials
Page 2 of 4 1 2 3 4

Moderated by  HeelX, rvL_eXile 

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