2 registered members (OptimusPrime, AndrewAMD),
14,580
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Trying to create "wall-running".
#247792
01/22/09 16:38
01/22/09 16:38
|
Joined: Jan 2009
Posts: 20
Tuah
OP
Newbie
|
OP
Newbie
Joined: Jan 2009
Posts: 20
|
I've been working on a "wall running" script, but I'm quite a novice so I don't know if I'm on the right track. Basically what I want this to do is that if a character is standing on a surface that is not level, to turn its body so that it is standing 'upright', directly from the normal. I came up with this script from a "place_me_on_floor" script, changed so it would be applicable to any surface. function place_me_on_surface
{
vec_set(temp,my.z); //set primary vector
temp.z -= 5; // 'bout half a foot from the surface
var_angle[3] + { my.pan, my.tilt, my.roll }; // point angle in the direction of character's feet
vec_rotate(temp,angle); //rotate vector
c_trace(my.z, temp, IGNORE_ME); //trace from character's feet about half a foot
vec_set(my.z, target); // put on surface
vec_to_angle(my.tilt, normal); // stand "upright" from normal
vec_to_angle(my.roll, normal);
}
Last edited by Tuah; 01/22/09 16:39.
|
|
|
Re: Trying to create "wall-running".
[Re: Tuah]
#247881
01/23/09 04:02
01/23/09 04:02
|
Joined: Aug 2000
Posts: 1,140 Baunatal, Germany
Tobias

Moderator
|

Moderator
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
|
This will probably crash:
vec_set(temp,my.z);
"my.z" is not a vector, so you will copy garbage. "my.x" is a vector that included x,y,z.
vec_to_angle(my.roll, normal);
This also crashes, for same reason. "my.pan" is a vector that includes pan, tilt, roll, but my.roll is not a vector.
You want probably to do something like this:
c_trace(my.x,vector(my.x,my.y,my.z-5), IGNORE_ME); vec_to_angle(my.pan,normal);
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|