3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
3rd person camera problems
#355282
01/26/11 00:54
01/26/11 00:54
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
i was reading the topic "camera pan and entity pan" and i wouldve just replied to his with my question but i didnt think it would be right. so please forgive me for making a 2nd topic on one subject  anyways, im trying to make a 3rd person cam as well, but every time i mention the temp vector, it says x is an undeclared identifier, i dont get it. why is it doing this? it happens in lines like this:
vec_diff(temp.x,camera.x,my.x);
i of course have a variable to define "temp". i dont understand what im doing wrong.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: 3rd person camera problems
[Re: Doc_Savage]
#355283
01/26/11 01:21
01/26/11 01:21
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
type of temp is VECTOR or var[3]?
Last edited by Quadraxas; 01/26/11 01:21.
3333333333
|
|
|
Re: 3rd person camera problems
[Re: Quad]
#355285
01/26/11 03:49
01/26/11 03:49
|
Joined: Jan 2011
Posts: 120 United States
Logan
Member
|
Member
Joined: Jan 2011
Posts: 120
United States
|
Yeah. To access x, y, or z, temp would have to be defined as "VECTOR temp" or "VECTOR* temp". If it's var temp[3], you would have refer to them as temp[0], temp[1], and temp[2]... although in your line of code you posted, both of those would be redundant, since you're referring to temp as a whole, not just the x component.
vec_diff(temp,camera.x,my.x);
See how that works.
|
|
|
Re: 3rd person camera problems
[Re: Logan]
#355288
01/26/11 07:00
01/26/11 07:00
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
haaaa... oh man.. it was a variable not a vector.. im so dumb.. hahah ok one more question (i think) whats wrong with this line?
result = c_trace(my.x,temp.x(my.x,my.y,my.z-100),IGNORE_PASSABLE|IGNORE_MODELS);
it says: "call function @temp_01264 error" i wish i knew what that meant. see this code was for a morrowind type camera script, where i could press a button and switch between the 2, i started in c_script and have now converted it. exept for this part. here was the origional:
trace_mode = ignore_me+ignore_passable+ignore_models;
result = trace(my.x,temp.x);
im guessing i got some part wrong in the conversion. hehe.. thanks in advance for putting up with my dumb questions fellas lol.
Last edited by Doc_Savage; 01/26/11 07:43.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: 3rd person camera problems
[Re: 3run]
#355294
01/26/11 08:43
01/26/11 08:43
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
ive read it. in the gamestudio help right? yea ive read it. rather incomplete imo. cant find anything on this problem. any idea what i did wrong?
Last edited by Doc_Savage; 01/26/11 08:46.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: 3rd person camera problems
[Re: Doc_Savage]
#355296
01/26/11 09:01
01/26/11 09:01
|
Joined: Jun 2006
Posts: 379 Flevoland, 5 meters under wate...
Roel
Senior Member
|
Senior Member
Joined: Jun 2006
Posts: 379
Flevoland, 5 meters under wate...
|
result = c_trace(my.x,temp.x(my.x,my.y,my.z-100),IGNORE_PASSABLE|IGNORE_MODELS);
it's the temp.x(my.x,my.y,my.z-100) I don't exactly know what you mean with the code, but you can use both: .....vector(my.x,my.y,my.z-100)..... or ....temp.... you have to set temp[0] <== x, temp[1] <== y and temp[2] <==z to the values you want when you type temp.x(my.x,my.y,my.z-100) the compiler will start searching for a function x of the object temp, and give it the arguments my.x,my.y and my.z-100.... which doesn't exist. I hope this helps
|
|
|
Re: 3rd person camera problems
[Re: Roel]
#355298
01/26/11 09:24
01/26/11 09:24
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
ok ive gotten this solved, but for some reason when i move foreward or backward the camera dosent move with the player...
gaah its all messed up. maye i should stick with 1st person...
Last edited by Doc_Savage; 01/26/11 09:29.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Re: 3rd person camera problems
[Re: 3run]
#355301
01/26/11 09:48
01/26/11 09:48
|
Joined: Jan 2010
Posts: 145
Doc_Savage
OP
Member
|
OP
Member
Joined: Jan 2010
Posts: 145
|
this is all i can really show atm.
function Switch_Views()
{
if(camera_ViewMode == 1) // 1st Person
{
vec_for_vertex(eyespot,my,69);
camera.genius = my;
camera.arc = 80;
vec_set(camera.x,vector(my.x,my.y,my.z+30));
my.pan = camera.pan;
camera.roll = my.roll;
if(key_o){
camera.tilt += 50 * mouse_force.y * time_step;
camera.pan -= 50 * mouse_force.x * time_step;
}
else
camera.pan -= 10 * mouse_force.x * time_step;
camera.tilt += 10 * mouse_force.y * time_step;
camera.tilt = clamp(camera.tilt,-90,90);
if(key_e)
{camera.roll = 30;
camera.y = 20;
}
if(key_q)
{camera.roll = -30;
camera.y = -20;
}
}
else // 3rd Person
{
my.pan = camera.pan;
camera.pan -= mouse_force.x * 12 * time_step;
camera.tilt += mouse_force.y * 8 * time_step;
camera.tilt = clamp(camera.tilt,-30,10);
temp = fcos(camera.tilt,-camera_distance);
vec_set(camera.x,vector(my.x + fcos(camera.pan,temp),my.y +
fsin(camera.pan,temp),my.z + 20 + fsin(camera.tilt,-camera_distance)));
vec_diff(temp.x,camera.x,my.x);
vec_normalize(temp.x,16);
vec_normalize(temp.z,50);
vec_set(camera.x,target.x);
vec_add(camera.x,temp.x);
result = c_trace(my.x,temp.x,vector(temp.x,temp.y,temp.z-10),IGNORE_PASSABLE|IGNORE_MODELS);
if (result > 0) {
vec_diff(temp.x,my.x,target.x);
vec_normalize(temp.x,16);
vec_set(camera.x,target.x);
vec_add(camera.x,temp.x);
}
}
}
first person is fine, 3rd person is messed up. seems i over complicated it 
Last edited by Doc_Savage; 01/26/11 09:51.
Do not concern yourself with my race, personality or origin. find my record in the pits, and then make your wager.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|