Forum

top down camera

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

top down camera

Postby hondobondo » Fri Feb 06, 2009 12:33 am

I am working on a gauntlet style mod. i can make the camera look down, but mouse look breaks that. if i disable mouselook, i still can't get aim to work. he just shoots at the ground. is there a way to fix the aim to just shoot straight ahead? i use normalize((self.origin+v_forward*500) - self.origin) but that makes him shoot however the mouse is aiming. how do i get him to just shoot from the origin+view_ofs to a point say 100 units straight ahead?
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Postby Spike » Fri Feb 06, 2009 4:22 am

m_pitch 0
Evil, I know, but it stops mouselook from doing anything in pretty much all engines.

Clear out self.v_angle_x on the server before doing makevectors. This will set their angles as pure yaw (and a bit of roll, but that doesn't affect forwards), meaning that forward really is forward, even if their client ignored the m_pitch thing, and will always be properly normalised too.
The alternative is to 'tweek' the v_forward vector and set v_forward_z=0, but that's ugly, and breaks in certain clients/settings. And it needs normalising as well.

Clearing out their pitch is the more correct way to do it.

normalize((self.origin+v_forward*500) - self.origin)
is more simply written as:
v_forward
just so you know. :)

So yeah...
self.v_angle_x = 0;
makevectors(self.v_angle);
source = self.origin + self.view_ofs;
target = source + v_forward*500;
you prolly want a traceline here
impact would then be at trace_endpos but then you knew that already. mneh
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby MauveBib » Fri Feb 06, 2009 4:28 am

WriteByte (MSG_ONE, 10); // 10 = SVC_SETVIEWANGLES
WriteAngle(MSG_ONE, vec_x); // tilt
WriteAngle(MSG_ONE, vec_y); // yaw
WriteAngle(MSG_ONE, vec_z); // flip
Apathy Now!
User avatar
MauveBib
 
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

thanks dudes

Postby hondobondo » Fri Feb 06, 2009 4:14 pm

totally owe you both. graces
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

thanks spike

Postby hondobondo » Fri Feb 06, 2009 6:05 pm

Spike wrote:m_pitch 0
Evil, I know, but it stops mouselook from doing anything in pretty much all engines.

Clear out self.v_angle_x on the server before doing makevectors. This will set their angles as pure yaw (and a bit of roll, but that doesn't affect forwards), meaning that forward really is forward, even if their client ignored the m_pitch thing, and will always be properly normalised too.
The alternative is to 'tweek' the v_forward vector and set v_forward_z=0, but that's ugly, and breaks in certain clients/settings. And it needs normalising as well.

Clearing out their pitch is the more correct way to do it.

normalize((self.origin+v_forward*500) - self.origin)
is more simply written as:
v_forward
just so you know. :)

So yeah...
self.v_angle_x = 0;
makevectors(self.v_angle);
source = self.origin + self.view_ofs;
target = source + v_forward*500;
you prolly want a traceline here
impact would then be at trace_endpos but then you knew that already. mneh


that works. now for the fun stuff. i can probably have a working beta with monsters and a map or two by monday
hondobondo
 
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am

Postby Boss429 » Tue Feb 10, 2009 6:04 pm

slightly off topic, but is m_pitch a cvar?
Boss429
 
Posts: 39
Joined: Sun Dec 03, 2006 7:29 pm

Postby mh » Tue Feb 10, 2009 6:08 pm

Yup, but don't even think about setting it's value through QC unless you're doing something like this that has a specific requirement, OK? :wink: :lol:
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest