Raised This Month: $ Target: $400
 0% 

Set an entities gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 03-05-2018 , 10:44   Set an entities gravity
Reply With Quote #1

Is there a way to set a "prop_physics" gravity? I am able to easily set a client's gravity with "SetEntityGravity", but this is not working for other types of props within the game. Here is the code I am using:

PHP Code:
stock CreateProp(Float:Origin[3])
{
    
iProp CreateEntityByName("prop_physics");
    if(
IsValidEntity(iProp))
    {
        
DispatchKeyValue(iProp"model""models/props_wasteland/prison_toilet01.mdl");
        
DispatchSpawn(iProp);

        
SetEntityGravity(iProp4.0); // NOT WORKING

        
TeleportEntity(iPropOriginNULL_VECTORNULL_VECTOR);
    }

Thanks in advance!
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT

Last edited by scorpius2k1; 03-05-2018 at 10:45.
scorpius2k1 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-05-2018 , 12:13   Re: Set an entities gravity
Reply With Quote #2

SetEntityMoveType(iProp, MOVETYPE_CUSTOM);

Or

SetEntityMoveType(iProp, MOVETYPE_ISOMETRIC);

__________

First one might not work at all and second one might crash your server.

Try the rest of the movetypes though:

https://sm.alliedmods.net/new-api/en...tocks/MoveType
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 03-05-2018 at 12:13.
eyal282 is offline
scorpius2k1
Senior Member
Join Date: Feb 2016
Old 03-05-2018 , 14:08   Re: Set an entities gravity
Reply With Quote #3

Quote:
Originally Posted by eyal282 View Post
SetEntityMoveType(iProp, MOVETYPE_CUSTOM);

Or

SetEntityMoveType(iProp, MOVETYPE_ISOMETRIC);

__________

First one might not work at all and second one might crash your server.

Try the rest of the movetypes though:

https://sm.alliedmods.net/new-api/en...tocks/MoveType
Thanks for the help, unfortunately, no luck. There is an effect with both; the entity freezes wherever it is spawned (in the air, etc) and will not move. The entities are affected by the server sv_gravity changes after a map change so I know there is a way to do it, but not sure about the SourceMod call to do it...
__________________
{__ PIRATES COVE __} ● HIGH-KILL Community | Stats ●
Half-Life 2: Deathmatch
66.151.244.149:27016 => CONNECT
scorpius2k1 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 03-05-2018 , 15:38   Re: Set an entities gravity
Reply With Quote #4

https://mxr.alliedmods.net/hl2sdk-sd...nterface.h#683

VPhysics doesn't actually have a way to set an individual object's gravity, it is set at the environment level.

Take a gander at the VPhysics extension (and after almost 8 years I just noticed I never included the demo video in that thread...)
__________________
asherkin is offline
Xeogin
New Member
Join Date: Aug 2015
Location: NC, USA
Old 04-03-2018 , 21:03   Re: Set an entities gravity
Reply With Quote #5

May not be exactly what you want, but here's a plugin that can be used to set the "prop" gravity for the next map, thus giving independent control of what the players start out with and what the props end of having.

https://forums.alliedmods.net/showthread.php?t=184610

The second page of that thread has a version that applies in the beginning of the round that may be of interest as well.
Xeogin is offline
Reply


Thread Tools
Display Modes

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 19:39.


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