.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
v_angle.y is always 0 ???
Old
  (#1)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default v_angle.y is always 0 ??? - 24-02-2005

In cz, client, these are always 0.
LOG_CONSOLE(PLID, "v_angle= %d\n",serverEntity->v.v_angle.y);
LOG_CONSOLE(PLID, "angles = %d\n",serverEntity->v.angles.y);

Why is that?
I need to
1) have the direction the player is pointing (like when you turn using the mouse and look in some direction)
2) I need to set the direction to 0 to force the player to look in the 0 direction.
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#2)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: v_angle.y is always 0 ??? - 24-02-2005

the "serverEntity" seems to be INDEXENT(0), which is the worldspawn entity instead of players...

also I don't think CZero is different from CS 1.6, as the dll file is actually the same (use "fc" in Windows or diff in GNU/Linux to check). The client's pev->angles.y and pev->v_angle.y shouldn't be zero
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#3)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: v_angle.y is always 0 ??? - 24-02-2005

I think I've found your problem... the problem is about the "%d":
PHP Code:
whistler@www:~$ cat 1.c
#include <stdio.h>
main()
{
 
float a 20;
 
printf("%d\n"a);
 
printf("%f\n"a);
}

whistler@www:~$ gcc 1.c
whistler
@www:~$ ./a.out
0
20.000000
whistler
@www:~$ 
use %f instead, or cast it to integer value and you'll get the right result
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: v_angle.y is always 0 ??? - 24-02-2005

aren't you ashamed of asking questions like that, Austin man...



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#5)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: v_angle.y is always 0 ??? - 24-02-2005

Da! -DAAAAAhh!!!
Ok can I say it was REALLY late last night!
Noooo. please wipe delete this msg from the server!...
Ashamed, yes, totally shamed... Balaaagg...

But even so you wouldn't think the implicit cast would work that way now do ya...


Either give me a compile warning, or do a "reasonable" cast ok?

tx. everyone.
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#6)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 690
Join Date: Dec 2003
Location: Holland
Default Re: v_angle.y is always 0 ??? - 24-02-2005

Its better to use %f than casting...
Otherwise you can try c++ style casting:
Code:
 LOG_CONSOLE(PLID, "v_angle= %d\n",static_cast<int>(serverEntity->v.v_angle.y));
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: v_angle.y is always 0 ??? - 24-02-2005

that's the problem with you guys overused to C++... you cannot even format a printf string properly

If you want to round a float value use %.nf, where n is the number of digits you want after the dot.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#8)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: v_angle.y is always 0 ??? - 25-02-2005

ex.
Code:
LOG_CONSOLE (PLID, "v_angle= %0.2f\n", serverEntity->v.v_angle.y);

round it to two decimal points .
Sorry guys i haven`t been here for awhile, ive been really busy helping out a cs : s clan .


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025

Last edited by dub; 25-02-2005 at 01:50..
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#9)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: v_angle.y is always 0 ??? - 25-02-2005

Ok, now that I am printing out the angles.
I am trying to create spawn points for my map editor.

I need to generate a line like this:
"angles" "0 90 0"
For spawn points the angles are 0,90,180,270,

My primitive understanding of angles is:
In the map we have x,y,z coordinates.

If I spawn into the map with a spawnpoint like this:
{
"origin" "16 -1872 -416"
"angles" "0 0 0"
"classname" "info_player_deathmatch"
}

I will spawn into the map aligned on the x axis facing the direction where x “get smaller”

This is true for the MAP coordinates I guess.
But it looks like the angles go from 0 to180 and 0 to –180.

I could do the conversion but I bet there is some standard code or a function call to convert this to 0-360.

Any suggestions?

Last edited by Austin; 25-02-2005 at 09:01..
  
Reply With Quote
Re: v_angle.y is always 0 ???
Old
  (#10)
Rick
Council Member
 
Rick's Avatar
 
Status: Offline
Posts: 690
Join Date: Dec 2003
Location: Holland
Default Re: v_angle.y is always 0 ??? - 25-02-2005

Just substract -180 from the y and z angle and wrap them with something like this:
Code:
float WrapYZAngle(float angle)
{
	 while (angle >= 360.0f) angle -= 360.0f;
	 while (angle < 0.0f) angle += 360.0f;

	 return angle;
}
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com