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 4 of 4 1 2 3 4
Re: Elevator cable [Re: ulillillia] #74534
06/04/06 23:56
06/04/06 23:56
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
ok drew a simple picture to translate.
I think your just over complicating what you're trying to do.

Since your already handlign movment with the liftcar and the counterwieght. you don;t NEED to simulate movment of the able based on any time calcuation. that is already being done with your movement code.



Re: Elevator cable [Re: Grimber] #74535
06/05/06 09:28
06/05/06 09:28
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
I still need some help, what do you mean by "Vertex attach cable model at point A", can I just move the origin point of the cable to the point A or do I have to 'attach' the cable to point A (how)?

Get direction vector, how do I do that?

For movement of the liftcar and counterweight I use;
....
while (elevator.z > floor1)
{
elevator.z -= elevator.z_speed * time;
conterweight.z += elevator.z_speed * time;
...

How does the cable scale itself with the used movement?

Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74536
06/06/06 00:49
06/06/06 00:49
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
ok vertex attachment. You can look at the examples on the Resource site wdl scripts. Also Alex Russell gave a nice little tutorial (also on resource site under tutorials ) on vertex attachment as well, but here is the nutshell

on the pully/moter model assembly i need the vertex Number at point 'A'
so I open the model up in MED, find a vertex at that location ( or place one if need be) select the vertex and bottem left hand border of MED will give me the vertex's number.

now, using the instruction vec_for_vertex I can get the world x/y/z location fo that Vertex by referancing that vertex number.

my cable model, it's origin point placed at its top center, I then change its x/y/z to equal that Vertex x/y/z we referanced above with vec_to_vertex.


so now my cable model top is lined up at point A

ow I need point 'a' depending on how you built the counter weight ) model or map entity ) will determine how we get 'a'
If a map entity then we just align our counterwieghts originpoint to be at 'a' when we build it.

if a model, then we do as above. we need a vertex point (vec_for_vertex)

we now have 2(two) vector points in space

A and a

with 2 vector points we can calculate distance and direction very fast, the engine has instrucitons for these

vec_dist(vector A, vector a) will give us the distance in quants from 'A' to 'a'
vec_diff(vector temp, vector a. vector A) will give us a direction vector result (temp) from 'A' to 'a'. **note the ORDER you place the vectors makes a differance**

read up on these 2 instructions

now for our scale. of my original cable model is made at 100 quants tall ( for example) then i just take the RESULT of vec_dist(A,a) divide it by 100 ( length of our cable) and that will give you the scale value to scale the cable Z value

i.e.

my.scale_z = vec_dist(A,a);

so if the distance from A to a is 100 quants (100/100 = 1) the scale would be 1
if the distance A to a is 200 the scale is 2 (200/100 = 2)( 2 times the original length)
if teh distance A to a is 50 the scale is .5 (50/100 = .5)( half the length)

as the counterwight moves by your movment script, we just recalcualte the vec_dist every frame and reapply the new scale

and so forth

for the correct angle alignment, a little more work is involved because we made trhe model vertical, but not much. ( we can cut the work if we set one end of the model at the origin and then the cabel down the length of the +X axis in MED)

this would make it easier but not necissary

vec_diff will give us a direction vector. vec_diff(temp,a,A) the direction from A to a this is in vector direction so we have to convert it to angles

vec_to_angle will convert our direction vector to pan and tilt angles from A to a

vec_diff(temp,a,A)
vec_to_angle(cable_model.pan,temp)

would point my cable model picture above so it points from A to a

since we built our cable model though as :

the agles will be off by 90 degrees.

so we just subtract 90 off the tilt after we do the above

vec_diff(temp,a,A)
vec_to_angle(cable_model.pan,temp)
cable_model.tilt -90;

now our cable will be in line from A to a


repeat for B to b as well.

Re: Elevator cable [Re: Grimber] #74537
06/06/06 09:42
06/06/06 09:42
Joined: Mar 2006
Posts: 724
the Netherlands
Frits Offline OP
User
Frits  Offline OP
User

Joined: Mar 2006
Posts: 724
the Netherlands
Now your talking! All this is verry new to me so I have downloaded the tutorial from Alex Russell. I will study your solution and the tutorial, after that I will try to make the thing working and will give you the result of my effort.

Thanks a lot,
Regards,
Frits


I like to keep scripting simple, life is hard enough as it is.
Regards,
Frits
Re: Elevator cable [Re: Frits] #74538
06/06/06 11:30
06/06/06 11:30
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
one correction

my.scale_z = vec_dist(a,A)/cable_length_in_quants;


sorry was very late when i wrote the reply above so I didn;t add in the division as i showed in the examples below the line

Page 4 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