|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Camera Path
#279119
07/16/09 15:50
07/16/09 15:50
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
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:
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: Widi]
#279204
07/16/09 21:29
07/16/09 21:29
|
Joined: Feb 2009
Posts: 3,207 Germany, Magdeburg
Rei_Ayanami
OP
Expert
|
OP
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
yes, i think 20 - 25 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]
#280211
07/21/09 13:28
07/21/09 13:28
|
Joined: Apr 2008
Posts: 144 Germany | Niedersachsen (Lower...
Roxas
Member
|
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!
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
|
|
|
|