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

[ H3LP ] SetOrigin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 10-16-2017 , 04:26   [ H3LP ] SetOrigin
Reply With Quote #1

Hello. So I made this simple stock.

Code:
stock SetSimpleOrigin(iEnt, iOrigin[3]) {     if (iEnt <= GetMaxPlayers)         set_user_origin(iEnt, iOrigin);     else     {         new Float: fOrigin[3];         IVecFVec(iOrigin, fOrigin);         engfunc(EngFunc_SetOrigin, iEnt, fOrigin);     } }

How can I modify this to easely set the brush entity origin correctly? I have a stock that gets the brush origin, but I want to set it correctly. The problem is, once I rotate the entity (when rotating the origin is set correctly), when moving it, the origin's no longer the correct one while moving, so it goes far away from the player. Thanks !

Last edited by DarthMan; 10-17-2017 at 17:07. Reason: Solved
DarthMan is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 10-16-2017 , 10:31   Re: [ H3LP ] SetOrigin
Reply With Quote #2

get the new origin when you move the entity and work further from that?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 10-16-2017 , 12:06   Re: [ H3LP ] SetOrigin
Reply With Quote #3

Try this:
Code:
SetEntityOrigin(ent, const Float:newOrigin[3]) {     new Float:origin[3];     origin = GetEntityOrigin(ent);         new Float:offs[3];     offs[0] = newOrigin[0] - origin[0];     offs[1] = newOrigin[1] - origin[1];     offs[2] = newOrigin[2] - origin[2];         pev(ent, pev_origin, origin);         origin[0] += offs[0];     origin[1] += offs[1];     origin[2] += offs[2];         engfunc(EngFunc_SetOrigin, ent, origin); }
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
DarthMan
Veteran Member
Join Date: Aug 2011
Old 10-16-2017 , 13:07   Re: [ H3LP ] SetOrigin
Reply With Quote #4

Quote:
Originally Posted by PRoSToTeM@ View Post
Try this:
Code:
SetEntityOrigin(ent, const Float:newOrigin[3]) {     new Float:origin[3];     origin = GetEntityOrigin(ent);         new Float:offs[3];     offs[0] = newOrigin[0] - origin[0];     offs[1] = newOrigin[1] - origin[1];     offs[2] = newOrigin[2] - origin[2];         pev(ent, pev_origin, origin);         origin[0] += offs[0];     origin[1] += offs[1];     origin[2] += offs[2];         engfunc(EngFunc_SetOrigin, ent, origin); }
Thanks, will check it out ;)
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 10-17-2017 , 17:08   Re: [ H3LP ] SetOrigin
Reply With Quote #5

Quote:
Originally Posted by PRoSToTeM@ View Post
Try this:
Code:
SetEntityOrigin(ent, const Float:newOrigin[3]) {     new Float:origin[3];     origin = GetEntityOrigin(ent);         new Float:offs[3];     offs[0] = newOrigin[0] - origin[0];     offs[1] = newOrigin[1] - origin[1];     offs[2] = newOrigin[2] - origin[2];         pev(ent, pev_origin, origin);         origin[0] += offs[0];     origin[1] += offs[1];     origin[2] += offs[2];         engfunc(EngFunc_SetOrigin, ent, origin); }
I partially fixed it, but not completly. Now it works for some entities.

Last edited by DarthMan; 10-17-2017 at 17:33.
DarthMan is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-17-2017 , 17:17   Re: [ H3LP ] SetOrigin
Reply With Quote #6

brush entities has its own origins...

It doesnt depends on the map origin like other entities do
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-17-2017 at 17:18.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DarthMan
Veteran Member
Join Date: Aug 2011
Old 10-17-2017 , 17:47   Re: [ H3LP ] SetOrigin
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
brush entities has its own origins...

It doesnt depends on the map origin like other entities do
Yeah I know, and their default origin is {0.0, 0.0, 0.0}.
DarthMan is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-17-2017 , 19:14   Re: [ H3LP ] SetOrigin
Reply With Quote #8

Quote:
Originally Posted by DarthMan View Post
Yeah I know, and their default origin is {0.0, 0.0, 0.0}.
No its Their spawn coordinates
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-19-2022 at 20:33.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 03:17.


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