Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP

Expert
Realspawn  Offline 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


Code:
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 laugh

Last edited by Realspawn; 07/31/15 15:21.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
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 Offline
Expert
Kartoffel  Offline
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: Kartoffel] #453546
07/31/15 17:02
07/31/15 17:02
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
forgive me my dumbness laugh i am not that good in understanding sometimes simple logics of code laugh Now the model can be left or right from the center of the Y axis so how to make it go the right direction to 0 ?

i will struggle to solve this grinnnnn but i sometimes get stuck with the simplest things lol laugh

thx anyway


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Moving on an to center y axis automaticly [Re: Realspawn] #453548
07/31/15 17:07
07/31/15 17:07

M
Malice
Unregistered
Malice
Unregistered
M



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: ] #453550
07/31/15 18:05
07/31/15 18:05
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
and your guessing is most of the time good laugh
i will give it a shot laugh

nice to see you back bro where have you been ? laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Moving on an to center y axis automaticly [Re: Realspawn] #453551
07/31/15 18:24
07/31/15 18:24
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
I'm not sure if I understand what you need, but here's what I'm thinking:

In case you want to limit a model in 3D space not to fall below the middle of the screen space, use vec_to_screen to get the screen coordinates of the model and if they are higher than (screen_size.y / 2) stop the falling...
But this requires a static camera height.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Moving on an to center y axis automaticly [Re: EpsiloN] #453554
07/31/15 22:19
07/31/15 22:19

M
Malice
Unregistered
Malice
Unregistered
M



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 Offline OP

Expert
Realspawn  Offline OP

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
no luck yet laugh i need the darn thing go to 0 on y grin 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 laugh

dang


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Moving on an to center y axis automaticly [Re: Realspawn] #453584
08/02/15 14:51
08/02/15 14:51
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
My.y = my.y * 0.95; ? Or other factor...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Moving on an to center y axis automaticly [Re: EpsiloN] #453585
08/02/15 15:33
08/02/15 15:33

M
Malice
Unregistered
Malice
Unregistered
M



Code:
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.
Page 1 of 2 1 2

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