Dampire
Member
|
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 |
|
Salival
Member
|
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 |
|
Dampire
Member
|
RE: Player direction.
I mean set direction of the player face to the wall.
|
|
10-08-2010 11:48 AM |
|
Dampire
Member
|
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 |
|
Dynad
Member
|
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 |
|
Dampire
Member
|
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 |
|
Arikin
Member
|
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 |
|