Author Topic: Camera reorientation and friction  (Read 3822 times)

LANS

  • Posts: 6
  • Turrets: +2/-0
Camera reorientation and friction
« on: November 10, 2008, 04:47:54 am »
How do I reduce or eliminate friction so that when a player is moving in a  direction, he keeps moving in that direction until he tries to move in another direction using the wasd keys or whatever he has set for movement? I've tried setting the regular friction parameter in bg_pmove.c to 0.0f, but it doesn't change anything, even if I just walk in a straight line. What do I have to change to make this happen?


On an unrelated note, I've also had little luck in finding how to make third-person-view default, and how to set it so that the camera stays pointing north-up regardless of how the player is turned.

Also, how do I find out which direction the player is aiming, be it either with two angles or a 1-unit-length vec3t?


Thanks

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: Camera reorientation and friction
« Reply #1 on: November 10, 2008, 07:13:54 am »
friction is defined per class in bg_misc.c (the variable at the top of bg_pmove.c is left over from q3 and unused).
you'll need to look at the cg_thirdperson code to make it always on.
the camera origin/angles are taken from cg.refDef, by default they are copied out of your predicted player state.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Kaleo

  • Posts: 2098
  • Turrets: +176/-220
    • KaleoDesign
Re: Camera reorientation and friction
« Reply #2 on: November 10, 2008, 09:21:35 am »
I'm sure a simple .cfg could default-erize cg_thirdperson 1.

Quote
seta cg_thirdperson 1

Correct me if I'm wrong by all means. Any excuse to further extend my knowledge.
Quote from: Stannum
Thou canst not kill that which doth not live,
but you can blow it into chunky kibbles!
I has a cookie, and u can has a cookie, but i no givs u mai cookie...

LANS

  • Posts: 6
  • Turrets: +2/-0
Re: Camera reorientation and friction
« Reply #3 on: November 10, 2008, 03:29:47 pm »
using the thirdperson command will switch to thirdperson, but it won't do it quite how I want. I've found the thirdperson camera code in cg_view.c, but I can't find where that code is called from.
I want to set the cg.refdefviewAngles[YAW] to something like
vec3_t facing
VectorCopy(<code to find where the player is facing, not sure the playerstate command I need>, facing)
cg.refdefviewAngles[YAW] = 360 - (bunch of math to figure out which angle the player is facing using facing[0] and facing[1], I need to brush up on my CAST rules)


googles

  • Posts: 219
  • Turrets: +30/-19
Re: Camera reorientation and friction
« Reply #4 on: November 12, 2008, 04:00:13 am »
just auto enable cg_thirdperson 1...its not hard