[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - vector math, combining angles and offsets

vector math, combining angles and offsets

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

vector math, combining angles and offsets

Postby daemon » Sat Mar 22, 2008 5:18 pm

I'm trying to locate the position of a weapon blade in the world based on a few angles and offsets.

I have:

self - (the player)
wep.targorigin - (the origin the weapon in the player's hand is moving toward)

wep is an attachment on the player, so it's origin is relative.
in order to find it's real origin in the world I do this:

---
ang = self.angles + vectoangles(wep.targorigin); // the angle in the world from the player origin to the weapon origin
ang_x = -ang_x; // negate the pitch
makevectors(ang); // get v_forward
wep_position = self.origin + v_forward*vlen(wep.targorigin); // the weapon origin in the world
---

now I have wep_position to base my next calculation from.
and also:
wep.targangles - (the angles the weapon is turning toward)
wep.damagepoint_ofs - (the offset of the weapon blade)

Image
wep.damagepoint_ofs being shown here as '8.7 0.2 23.23'

so I do the following to find the position of the weapon blade:

---
ang = self.angles + wep.targangles + vectoangles(wep.damagepoint_ofs); // the angle in the world from the weapon position to the weapon blade
ang_x = -ang_x; // negate the pitch again
makevectors(ang); // get v_forward
swing_end = wep_position + v_forward*vlen(wep.damagepoint_ofs); // the position of the blade in the world
---

for some reason this doesn't work out. the position of the blade ends up being calculated way off. I can't figure out what I'm doing wrong or what I need to do to make this work.

I suspect that it has something to do with this line:
ang = self.angles + wep.targangles + vectoangles(wep.damagepoint_ofs);

pitch, yaw, and roll are all tilted in wep.targangles, but self.angles and vectoangles(wep.damagepoint_ofs) only have a pitch and a yaw...

any ideas?
-daemon [ ]
User avatar
daemon
 
Posts: 81
Joined: Wed Nov 07, 2007 11:10 pm

Postby daemon » Sun Mar 23, 2008 12:21 am

-daemon [ ]
User avatar
daemon
 
Posts: 81
Joined: Wed Nov 07, 2007 11:10 pm

Postby daemon » Sun Mar 23, 2008 3:04 am

-daemon [ ]
User avatar
daemon
 
Posts: 81
Joined: Wed Nov 07, 2007 11:10 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 2 guests