AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate] (https://forums.alliedmods.net/showthread.php?t=336632)

Bacardi 03-04-2022 07:39

m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate]
 
Here quick tip about these two.

m_vecOrigin (Prop_Send, Prop_Data)
- Think this as "offset".
When entity has no parent (attached to anything), it give "offset" values from world coordinate 0.0, 0.0, 0.0
When entity is attached to another entity, it give "offset" values from parent entity origin (or parent attachment point).
- It is not world "coordinates".
"Offset" zero point is either center of world 0.0, 0.0, 0.0 or from parent entity origin (or parent attachment point).


m_vecAbsOrigin (Prop_Data)
- This give entity "coordinates" from world.






I learned today... harder way... by troubleshooting problem with bumpmines.

Psyk0tik 03-04-2022 08:29

Re: m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate]
 
I didn't know about this either until now. Thanks!

NoroHime 03-05-2022 23:41

Re: m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate]
 
some plugin uses GetClientEyePosition() to get player vector, is that good solution?

Bacardi 03-06-2022 06:08

Re: m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate]
 
Yes, it's correct. It's player view coordinates.

I mentioned about m_vecOrigin, because if you use it, your vector math could be suddenly wrong, if entity is attached to else entity.

Example if parent entity location in the world is 900.0, 900.0, -500.
The target entity you are looking is currently child, m_vecOrigin give you values like 25.0, 5.0, 0.0.

When target entity (child) is unattached from parent entity, target entity m_vecOrigin give you values like 890.0, 920.0, -499.0

You need understan this behaviour, why vector values changed to odd values suddenly.

Dragokas 03-27-2022 12:11

Re: m_vecOrigin [offset] vs. m_vecAbsOrigin [coordinate]
 
Thanks! Very useful info!


All times are GMT -4. The time now is 12:59.

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