Raised This Month: $32 Target: $400
 8% 

Need help with angles)


Post New Thread Reply   
 
Thread Tools Display Modes
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 11-23-2017 , 15:18   Re: Need help with angles)
Reply With Quote #11

The lagging happens because you have to update angles more often, try with 0.01/2.
KiLLeR. is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-24-2017 , 02:49   Re: Need help with angles)
Reply With Quote #12

you change angles 10 times a second (10fps) so ofc it moves weird
use think instead of task and try 25 to 30 times a second and it should look nicer
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-24-2017 , 07:23   Re: Need help with angles)
Reply With Quote #13

You can just set pev_avelocity. I believe angular velocity makes the entity rotate X degrees each second.
PHP Code:
set_pev(entityIdpev_avelocity, {90.045.0180.0}); 
will change entity's pitch by 90, yaw by 45 and roll by 180 degrees each second.
klippy is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-24-2017 , 11:20   Re: Need help with angles)
Reply With Quote #14

Quote:
Originally Posted by KliPPy View Post
You can just set pev_avelocity. I believe angular velocity makes the entity rotate X degrees each second.
PHP Code:
set_pev(entityIdpev_avelocity, {90.045.0180.0}); 
will change entity's pitch by 90, yaw by 45 and roll by 180 degrees each second.
one second is slowly.. but thx, I used this in other situation.
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-24-2017 , 11:21   Re: Need help with angles)
Reply With Quote #15

Quote:
Originally Posted by aron9forever View Post
you change angles 10 times a second (10fps) so ofc it moves weird
use think instead of task and try 25 to 30 times a second and it should look nicer
I know that think' func is faster, but I can't use it because never used before, Can u explain on an example for me, thx.

I found some code by xPaw in coloredSmoke plugin, but not fully understood how it works.
Code:
register_think( g_szClassname, "FwdThink_FakeSmoke" );
Attached Files
File Type: sma Get Plugin or Get Source (ColoredSmoke.sma - 390 views - 5.3 KB)

Last edited by ZASTRELIS; 11-24-2017 at 11:31.
ZASTRELIS is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-24-2017 , 11:36   Re: Need help with angles)
Reply With Quote #16

Quote:
Originally Posted by ZASTRELIS View Post
one second is slowly.. but thx, I used this in other situation.
A second can't be too slow. Avelocity just says how many degrees per second will an entity rotate. Basic physics. That doesn't mean that you can rotate it only for one second.

Last edited by klippy; 11-24-2017 at 11:37.
klippy is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-24-2017 , 11:52   Re: Need help with angles)
Reply With Quote #17

Quote:
Originally Posted by KliPPy View Post
A second can't be too slow. Avelocity just says how many degrees per second will an entity rotate. Basic physics. That doesn't mean that you can rotate it only for one second.
its gravitys' acceleration, I tested.. it looks more faster then default vel func, but not what I want, I need excelent rotating on client side)

Last edited by ZASTRELIS; 11-24-2017 at 11:55.
ZASTRELIS is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-24-2017 , 13:25   Re: Need help with angles)
Reply With Quote #18

Just a note, I didn't know about pev_avelocity, and just like you wouldn't move an entity by setting it's origin every 0.1 seconds (but instead by setting its velocity) you should probably do the same here as it would be way, way more efficient

anyways, each entity in the game has the ability to "think" at a certain time(in relation to halflife_time) and therefore you can set how often you want it to think

however unlike with tasks you can not define a callback function, but you must hook the think function and check if it's the right entity for you. You can do this in multiple ways, one of which you mentioned before with register_think. You can also hook FM_Think (which is called for all ents that think) and check pev_classname, if it matches, then do what you need, and set next think to halflife_time + 0.1. For default entity classtypes (like grenade) you can also use hamsandwich, have a look here https://forums.alliedmods.net/showthread.php?t=139164 (make sure to use POST hook since what is posted in that thread originally doesn't work)
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-24-2017 , 14:46   Re: Need help with angles)
Reply With Quote #19

Quote:
Quote:
Originally Posted by ZASTRELIS View Post
...I want, I need excelent rotating on client side)
Quote:
server_frame();
Spoiler
Quote:
Originally Posted by KliPPy View Post
A second can't be too slow. Avelocity just says how many degrees per second will an entity rotate. Basic physics. That doesn't mean that you can rotate it only for one second.
Good advice. Optimised, one of looped task less: "GrenTaskRotate"
Code:
... new Float:angles[3];     pev(id, pev_angles, angles);         angles[2] = 78.0;     set_pev(id, pev_avelocity, angles); ...

Last edited by ZASTRELIS; 11-25-2017 at 03:06.
ZASTRELIS is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-24-2017 , 16:58   Re: Need help with angles)
Reply With Quote #20

Who knows how to disable default nades' shaking when nade in air?

Last edited by ZASTRELIS; 11-25-2017 at 00:27.
ZASTRELIS is offline
Reply



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


All times are GMT -4. The time now is 22:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode