Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Camera Path #279119
07/16/09 15:50
07/16/09 15:50
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Hello!
I am trying to write a script that my camera follows a path. Until now I have this:
Code:
function camera_update()
{
	VECTOR temp;
	VECTOR position;
	var node_distance;
	var i = 1;
	path_set(my, "path_000");
	path_getnode(my, i, my.x, NULL);
	vec_set(camera.x, my.x);
	i=2;
	while(1)
	{
		path_getnode(my, i, position, NULL);
		vec_sub(position, my.x);
		vec_to_angle(my.pan, position);
		c_move(my, vector(0.5,0,0), nullvector, NULL);
		node_distance = c_trace(my.x,position.x, NULL);
		vec_set(camera.x, my.x);
		vec_set(camera.pan, my.pan);
		if(node_distance <= 0.001)
		{
			i++;
		}
		wait(1);
	}
}


My Problem is after the 3rd Node my Cam does what it want. It would be nice if you help me. PS: I have no Gamestudio A7 only lite-C - the map is made by someone else. Thanks and cheers
Rei_ayanami

Re: Camera Path [Re: Rei_Ayanami] #279135
07/16/09 17:18
07/16/09 17:18
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Can please anybody answer this - or give a hint

Re: Camera Path [Re: Rei_Ayanami] #279150
07/16/09 18:44
07/16/09 18:44
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
There are more answers on the warez user with the "going threw walls" problem :S frown

Re: Camera Path [Re: Rei_Ayanami] #279162
07/16/09 19:26
07/16/09 19:26
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Try to set the distance higher:
if(node_distance <= 0.001) // use 10.0 or more...
maybee that helps...

Re: Camera Path [Re: Widi] #279163
07/16/09 19:29
07/16/09 19:29
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
same!

Re: Camera Path [Re: Rei_Ayanami] #279200
07/16/09 21:20
07/16/09 21:20
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Do you have more than 3 Nodes in the map?

Re: Camera Path [Re: Widi] #279204
07/16/09 21:29
07/16/09 21:29
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
yes, i think 20 - 25
Quote:
PS: I have no Gamestudio A7 only lite-C - the map is made by someone else. Thanks and cheers
Rei_ayanami

Rei

Re: Camera Path [Re: Rei_Ayanami] #279369
07/17/09 12:13
07/17/09 12:13
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Can please anybody look?
I have check with a var that there are 26 nodes

Re: Camera Path [Re: Rei_Ayanami] #280211
07/21/09 13:28
07/21/09 13:28
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline
Member
Roxas  Offline
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
hey there

I've created a npc system and today I started coding pathes for them to run through my villages and stuff. I saw your post here and it helped me a little to create a framework hope it helps you a little if your problem is still there!


Code:
var nextnode;
var node_dist = 0;
ENTITY* cam_dum;

function attach_cam()
{
	vec_set(camera.x, my.x);
}

action pathing()
{
	 set(my, INVISIBLE);
	VECTOR node_pos;
	cam_dum = me;
	
	path_set(my,"path_000");	
	path_scan(my,my.x,my.pan,vector(360,360,1000));
	result = path_next(my);
	path_getnode(my,1,my.x, NULL);
	
	nextnode = path_nextnode(me,1,1);
	path_getnode(my,nextnode,node_pos, NULL);
	vec_sub(node_pos, my.x);
	vec_to_angle(my.pan,node_pos);
	
	while(1)
	{
		attach_cam();
		path_getnode(my,nextnode,node_pos, NULL);
		node_dist = vec_dist(my.x,node_pos);
		
		vec_sub(node_pos, my.x);
		vec_to_angle(my.pan,node_pos);
			
		c_move(my, vector(5*time_step,0,0), nullvector, NULL);
		if(node_dist <= 1)
		{
			nextnode += 1;
		}
		wait(1);
	}
}



this works pretty good for me (tested it with 10+ nodes)
the only problem is when he reaches the last node he don't know where to go so just add a little if statement that stops the function or reruns it. the camera doesn't turn around either, but thats not the problem i think!

hope its helpful

cheers
Roxas

Re: Camera Path [Re: Roxas] #280214
07/21/09 14:04
07/21/09 14:04
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline OP
Expert
Rei_Ayanami  Offline OP
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Thanks but I should write solved to this topic before wink. I have solved it myself. And I even had to think about other things, because the camera should always look in a 90° to the player.
But thanks very much smile


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