|
2 registered members (Quad, AndrewAMD),
1,007
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Turn to normal
#336566
08/05/10 00:44
08/05/10 00:44
|
Joined: May 2009
Posts: 5,365 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,365
Caucasus
|
I've made a climbing code, and I tried to turn players pan to surface that he's trying to climb on, but I fail, here is what I've tried: vec_for_angle(my.pan,normal); Picture to explain: 
|
|
|
Re: Turn to normal
[Re: 3run]
#336583
08/05/10 07:55
08/05/10 07:55
|
Joined: Mar 2002
Posts: 1,774 Magdeburg
FlorianP
Serious User
|
Serious User
Joined: Mar 2002
Posts: 1,774
Magdeburg
|
The Problem is vec_for_angle converts an angle into a vector. IN this case it sets my.pan to a value near 1 and that coincidentally works for the first wall. What you want is vec_to_angle(my.pan, normal) - after that u might have to set my.tilt -= 90.
Last edited by FlorianP; 08/05/10 07:57.
I <3 LINQ
|
|
|
Re: Turn to normal
[Re: bk9iq]
#336748
08/05/10 22:57
08/05/10 22:57
|
Joined: Mar 2002
Posts: 1,774 Magdeburg
FlorianP
Serious User
|
Serious User
Joined: Mar 2002
Posts: 1,774
Magdeburg
|
Sounds like your not hitting the right object/polygon - would be best if you posted your code. Anyway the general approach would be something like this
vec_set(temp, vector(50, 0, 0));
vec_rotate(temp, my.pan);
vec_add(temp, my.x);
if (c_trace(my.x, temp, IGNORE_ME | USE_BOX))
{
vec_to_angle(my.pan, normal);
my.tilt -=90;
}
Der Normalenvektor zeigt naturgemäß vom der getroffenen Oberfläche weg, setzt man ein standardmäßig ausgerichtetes Modell auf diese Rotation würde es 'auf der Oberfläche stehen'. my.tilt -=90 (evtl isses auch +=90, bin da grad nich sicher) rotiert den Player sozusagen mit dem Bauch zur Oberfläche.
Last edited by FlorianP; 08/05/10 23:00.
I <3 LINQ
|
|
|
Re: Turn to normal
[Re: FlorianP]
#336751
08/05/10 23:16
08/05/10 23:16
|
Joined: Jul 2010
Posts: 129
bk9iq
Member
|
Member
Joined: Jul 2010
Posts: 129
|
@FlorianP thanks bro very much ... I used ur method except for the my.tilt -=90; I used my.pan -= 180; and everything is working just fine... Thanks again... @3run ... here's what I used: VECTOR temp1; vec_set(temp1, vector(50, 0, 0)); vec_rotate(temp1, my.pan); vec_add(temp1, my.x); if (c_trace(my.x, temp1, IGNORE_ME | USE_BOX)) { vec_to_angle(my.pan, normal); my.pan -=180; }
|
|
|
|