Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,253 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 5 of 5 1 2 3 4 5
Re: How make player go to the point you clicked with mouse? [Re: Pappenheimer] #269613
06/03/09 18:51
06/03/09 18:51
Joined: Mar 2006
Posts: 321
Norway
Eagelina Offline OP
Senior Member
Eagelina  Offline OP
Senior Member

Joined: Mar 2006
Posts: 321
Norway
Originally Posted By: Pappenheimer
The following part from cerberi_croman's code should already stop the player from 'floating' beyond the point you clicked:

if(vec_dist(my.x,temp2)>=40)
{ c_move(me,vector(7*time_step,0,0),nullvector,IGNORE_ME|IGNORE_PASSABLE|GLIDE);
}

This means, the player only moves as long he isn't closer than 40 quants - that's a reasonable distance for the size of normal models - maybe the size of your model is much bigger. Play with the value, make it larger, 100 or 400, just to get an idea when the player stops walking.


Yes I had to change it to 250, then it worked. Thanks!


A6 and A7 Commercial
-------------------
Programmer always searching for more to learn and understand. smile
Re: How make player go to the point you clicked with mouse? [Re: Eagelina] #269626
06/03/09 20:14
06/03/09 20:14
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
put origin of your character under its feets and try using blocks instead of models for level geometry



Ubi bene, ibi Patria.
Re: How make player go to the point you clicked with mouse? [Re: croman] #269687
06/04/09 07:31
06/04/09 07:31
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline
Member
Gumby22don  Offline
Member
G

Joined: Oct 2006
Posts: 175
the other thing you can do to not overstep the mark you are moving towards is:

c_move(me,vector(minv(7*time_step,vec_dist(my.x,temp2)),0,0),nullvector,IGNORE_ME|IGNORE_PASSABLE|GLIDE);

It should then move 7*time_step, or the remaining distance, whichever is smaller.

Don
have a great day

Re: How make player go to the point you clicked with mouse? [Re: Gumby22don] #269700
06/04/09 08:43
06/04/09 08:43

M
mercuryus
Unregistered
mercuryus
Unregistered
M



It's not smart to use constants for the check if the player reached his destination (because the distance can vary of many reasons).

If you define that the player reached his destination when he get as closest as possible then the logic becomes easy:

1. store the distance to the destination before you move;
2. move;
3. check if the player got nearer to the destination - if not he has reached it;
4. (opt) place the player exacly on the destination


Re: How make player go to the point you clicked with mouse? [Re: Eagelina] #269907
06/05/09 07:41
06/05/09 07:41
Joined: Mar 2006
Posts: 321
Norway
Eagelina Offline OP
Senior Member
Eagelina  Offline OP
Senior Member

Joined: Mar 2006
Posts: 321
Norway
THANK YOU TO YOU ALL FOR YOUR HELP!!
Here are the code so far. It is working fine, point somewhere on the "floor" /"ground" and player moves there.
Code:
BMAP* arrow = "cursor.tga";
VECTOR temp;

function point_mouse()
{


  temp.x = mouse_pos.x;
  temp.y = mouse_pos.y;
  temp.z = 5000;
  vec_for_screen(temp,camera);
  c_trace(camera.x,temp,IGNORE_ME);
  	if(hit.x != NULL)
  	{
         vec_set(temp.x,hit.x);
  	}
}

function move_mouse();
function playerAct();

function main()
{
	
	video_mode = 8;
	video_screen = 2;
	
	level_load("test2.WMB");
	wait(2);
	mouse_mode = 1;
	mouse_map = arrow;
	move_mouse();
	
}

function move_mouse()
{
	while(1){vec_set(mouse_pos,mouse_cursor); wait(1);}
}


var walk_prosent;
var stand_prosent;
function playerAct()
{
	camera.z += 200;
	camera.tilt -= 35;
	
	c_setminmax(me);

	VECTOR temp2; vec_zero(temp2);
	ANGLE my_angle; vec_zero(my_angle);
	
	while(1){
		point_mouse();
		if(mouse_left==1){
			while(mouse_left){wait(1);}
			
			vec_set(temp2,temp.x); 
 		 	vec_sub(temp2,my.x);
  			vec_to_angle(my.pan,temp2); // now MY looks at YOU

			my.tilt = 0;
		
			temp2.z = my.z;
		}
		
		if(vec_dist(my.x,temp2)>=250) //>=40
		{
			c_move(me,vector(10*time_step,0,0),nullvector,IGNORE_ME|IGNORE_PASSABLE|GLIDE);
			ent_animate(me,"walk",walk_prosent,ANM_CYCLE);
			walk_prosent += 6 * time_step;
			
		}
	 else{
			ent_animate(my, "stand", stand_prosent, ANM_CYCLE); // then play its "stand" animation
			stand_prosent += 5 * time_step;
		}
			
		wait(1);
	}
}



A6 and A7 Commercial
-------------------
Programmer always searching for more to learn and understand. smile
Re: How make player go to the point you clicked with mouse? [Re: ] #269925
06/05/09 09:03
06/05/09 09:03

M
mercuryus
Unregistered
mercuryus
Unregistered
M



click on the image to download a demo (zip,2.4MB).
The model "kaiden2" is free from DevoN (thanx a lot).



Re: How make player go to the point you clicked with mouse? [Re: ] #269929
06/05/09 09:15
06/05/09 09:15
Joined: Mar 2006
Posts: 321
Norway
Eagelina Offline OP
Senior Member
Eagelina  Offline OP
Senior Member

Joined: Mar 2006
Posts: 321
Norway

@mercuryus
Wow Thanks ! Love it grin wink

The demo is great. I will now study the code and try to learn from it.

Thank you.


A6 and A7 Commercial
-------------------
Programmer always searching for more to learn and understand. smile
Page 5 of 5 1 2 3 4 5

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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