vp_parallel for a simple model!???????
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
vp_parallel for a simple model!???????
Hello!!!! I need know what function can work so that the mdl of an entity behaves with the orientation of a sprite vp_parallel or something similar. I thought about something similar to ai_face (); but not for a monster, just for a simple model, more precisely to create fog. But I cannot use sprites because the shaders doesn´t work
I do not know. Thank you very much, i am using darkplaces.

Last edited by Nahuel on Sun Aug 14, 2011 8:38 pm, edited 1 time in total.
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
well, if all you want is to make a model 'face' the player, than it's just a matter of getting the direction vector from the model to the player, and then converting that to yaw, and feeding the yaw directly into the y component of the angles vector:
pl = player entity
local vector vec;
local float yaw;
vec = pl.origin - self.origin;
yaw = vectoyaw(vec);
self.angles_y = yaw;
do this every frame and it will behave just like a vp_parallel sprite.
pl = player entity
local vector vec;
local float yaw;
vec = pl.origin - self.origin;
yaw = vectoyaw(vec);
self.angles_y = yaw;
do this every frame and it will behave just like a vp_parallel sprite.
- necros
- Posts: 77
- Joined: Thu Dec 16, 2004 10:32 pm
This wont work the same way because ai_face() doesn't take the z axis in account.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
necros wrote:well, if all you want is to make a model 'face' the player, than it's just a matter of getting the direction vector from the model to the player, and then converting that to yaw, and feeding the yaw directly into the y component of the angles vector:
pl = player entity
local vector vec;
local float yaw;
vec = pl.origin - self.origin;
yaw = vectoyaw(vec);
self.angles_y = yaw;
do this every frame and it will behave just like a vp_parallel sprite.
thank you necros
hi, I am nahuel, I love quake and qc.
-

Nahuel - Posts: 492
- Joined: Wed Jan 12, 2011 8:42 pm
- Location: mar del plata
there are many ways to get the player entity.
probably the simplest is to just use nextent.
nextent is a builtin function that will cycle through all entities. this is normally slow, but player entities are ALWAYS the first 4 entities, so in this case, it's extremely fast.
simply do this:
local entity pl;
pl = nextent(world);
this finds the next entity after world (the top of the list, entity #0) which will be player 1.
a safer method would be to just do a find().
pl = find(world, classname, "player");
will find the first player. i think it's slightly more expensive but not overly so, since it'll find it right away.
edit: when i read 'ai_face' in your first post, i assumed you wanted the model to stay upright.
my post will cause the model to behave like upright_parallel.
to make it behave exactly like vp_parallel, you must do this:
vec = pl.origin - self.origin;
self.angles = vectoangles(vec);
note vectoangles INSTEAD of vectoyaw. this will make it 'face' the player in both yaw AND pitch, emulating vp_parallel behaviour.
probably the simplest is to just use nextent.
nextent is a builtin function that will cycle through all entities. this is normally slow, but player entities are ALWAYS the first 4 entities, so in this case, it's extremely fast.
simply do this:
local entity pl;
pl = nextent(world);
this finds the next entity after world (the top of the list, entity #0) which will be player 1.
a safer method would be to just do a find().
pl = find(world, classname, "player");
will find the first player. i think it's slightly more expensive but not overly so, since it'll find it right away.
edit: when i read 'ai_face' in your first post, i assumed you wanted the model to stay upright.
my post will cause the model to behave like upright_parallel.
to make it behave exactly like vp_parallel, you must do this:
vec = pl.origin - self.origin;
self.angles = vectoangles(vec);
note vectoangles INSTEAD of vectoyaw. this will make it 'face' the player in both yaw AND pitch, emulating vp_parallel behaviour.
- necros
- Posts: 77
- Joined: Thu Dec 16, 2004 10:32 pm
...that is why my winged-demon model always starts to lean back a little when flying upwards.
It is because ai_face() doesn't take the z axis in account !!
And when the entity´s z-position gets higher than the players, this happens...
Thank you frag.machine & necros.
Just like Nahuel said:
What would we noobs be, without all the kind + helpful people here at inside3d ?
Best wishes,
Seven
It is because ai_face() doesn't take the z axis in account !!
And when the entity´s z-position gets higher than the players, this happens...
Thank you frag.machine & necros.
Just like Nahuel said:
What would we noobs be, without all the kind + helpful people here at inside3d ?
Best wishes,
Seven
- Seven
- Posts: 301
- Joined: Sat Oct 06, 2007 8:49 pm
- Location: Germany
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest