About Store Forum Documentation Contact



Post Reply 
Player direction.
Author Message
Dampire Offline
Member

Post: #1
Player direction.
How to set precision direction for player, if I have only required direction?
For some reason this code doesn't work.
Code:
owner().angle.x+=AbsAngleBetween(AbsAngleBetween(owner().matrix().z.xz(), wall_normal.xz());
(This post was last modified: 10-08-2010 08:13 AM by Dampire.)
10-08-2010 08:12 AM
Find all posts by this user Quote this message in a reply
Salival Offline
Member

Post: #2
RE: Player direction.
Do you mean follow the angle of wall or face target?

Face current vFacePoint:

Code:
Vec vFacePoint; //Your face point.

Flt angle_delta = AngleDelta(owner().angle.x+PI_2, Angle(vFacePoint.xz() - owner().pos().xz()));
Flt max_delta = Time.d()*DegToRad(270);

Clamp(angle_delta, -max_delta, max_delta);
owner().angle.x += angle_delta;
(This post was last modified: 10-08-2010 09:18 AM by Salival.)
10-08-2010 09:16 AM
Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #3
RE: Player direction.
I mean set direction of the player face to the wall.
10-08-2010 11:48 AM
Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #4
RE: Player direction.
I realized vertical wallrun, but i have troubles with player direction. I can't set direction to the wall.
10-09-2010 05:53 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: Player direction.
Well the code that Salival has posted should work tho... if u just replace the owner() with your wall code.

There is always evil somewhere, you just have to look for it properly.
10-09-2010 01:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #6
RE: Player direction.
I modified the code for my needs.
Code:
Vec nFacePoint;
nFacePoint = owner().pos() + (-wall_normal);

Flt angle_delta =
     AngleDelta(owner().angle.x+PI_2, Angle(nFacePoint.xz() - owner().pos().xz()));
Flt max_delta = Time.d()*DegToRad(90);
Clamp(angle_delta, -max_delta, max_delta);
owner().angle.x+=angle_delta;

Thanks for help.
(This post was last modified: 10-10-2010 06:45 AM by Dampire.)
10-10-2010 06:41 AM
Find all posts by this user Quote this message in a reply
Arikin Offline
Member

Post: #7
RE: Player direction.
What about facing up and down? Rotation around y axis? I tried some combinations of this code but still doesn't work. Anyone help?
10-24-2010 02:19 PM
Find all posts by this user Quote this message in a reply
Post Reply