2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Moving on an to center y axis automaticly
#453537
07/31/15 15:20
07/31/15 15:20
|
Joined: Jul 2001
Posts: 4,801 netherlands
Realspawn
OP
Expert
|
OP
Expert
Joined: Jul 2001
Posts: 4,801
netherlands
|
I have this model that i place random in my level. I need it to move automaticly but it should always move to 0 on the y axis so the models are placed in the air then go down to a cetain hight but always should land on the middle of the screen on the y
action landing_ufo()
{
set(my,SHADOW | METAL | POLYGON);
ufo=me;
while(1)
{
c_move(my, vector(15 * time_step, 0, 0), nullvector, NULL | IGNORE_SPRITES | IGNORE_PASSABLE);
my.z -=2* time_step;
camera.x = ufo.x+100;
camera.z = 1000;
camera.tilt = -90;
wait(1);
if(plane.z <= -12){
you_madeit();
break;
wait(1);
}
}
any help would be highly aprreciated as it is for a next retro workshop game i have almost finished
Last edited by Realspawn; 07/31/15 15:21.
|
|
|
Re: Moving on an to center y axis automaticly
[Re: Realspawn]
#453538
07/31/15 15:31
07/31/15 15:31
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
well you just need to keep moving it towards the y = 0 coordinate and check if it has crossed it (per frame). when the if comparison is true you simply stop the movement and set it's y coordinate manually to 0 to avoid inaccuracy errors.
soo there's really not much to it...
POTATO-MAN saves the day! - Random
|
|
|
Re: Moving on an to center y axis automaticly
[Re: Realspawn]
#453548
07/31/15 17:07
07/31/15 17:07
|
Malice
Unregistered
|
Malice
Unregistered
|
VECTOR vec_temp
action ..... { vec_set(vect_temp,my.x); vec_diff(vec_temp,vector(0,0,0),vec_temp); vec_normalize(vec_temp,5); c_move(my, nullvector,vec_temp,.....);
Blind guessing
Last edited by Malice; 07/31/15 17:08.
|
|
|
Re: Moving on an to center y axis automaticly
[Re: EpsiloN]
#453554
07/31/15 22:19
07/31/15 22:19
|
Malice
Unregistered
|
Malice
Unregistered
|
I'm not back... I am a ghost. There is no coming back lol
|
|
|
Re: Moving on an to center y axis automaticly
[Re: ]
#453577
08/01/15 23:33
08/01/15 23:33
|
Joined: Jul 2001
Posts: 4,801 netherlands
Realspawn
OP
Expert
|
OP
Expert
Joined: Jul 2001
Posts: 4,801
netherlands
|
no luck yet i need the darn thing go to 0 on y lol i could use my.y = 0; but then it jumps right to it so it needs to move to zero - on y or + depending which side it is dang
|
|
|
Re: Moving on an to center y axis automaticly
[Re: EpsiloN]
#453585
08/02/15 15:33
08/02/15 15:33
|
Malice
Unregistered
|
Malice
Unregistered
|
action .....
{
VECTOR vec_temp;
VECTOR vec_temp2;
vec_set(vec_temp,my.x); // set temp vec to my location
vec_diff(vec_temp2,vector(0,0,0),vec_temp); // make temp point from my location to vec 000
vec_normalize(vec_temp2,5*time_step); // set your speed here
c_move(my, nullvector,vector(0,vec_temp2.y,0),.....); // move on the abs to 0 y
And why does this not work?? If you only use the Y axis? Some simple things you should notice. 1) this has to run in a loop. Walk in you mind loop steps, first run it moves 5 closer to 0y next run 5 more, if it cross 0y it move 5 towards 0y on the next loop. 2) a lock maybe need ... if(my.y != 0)
Last edited by Malice; 08/02/15 15:48.
|
|
|
|