Raised This Month: $51 Target: $400
 12% 

Stopping a physprop from rolling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MikeJS
Senior Member
Join Date: Nov 2008
Old 01-14-2014 , 05:55   Stopping a physprop from rolling
Reply With Quote #1

I'm trying to make a prop_physics_override but restricting its rotations to yaw only. SOLID_BBOX/SOLID_OBB_YAW appear to be what I want but I haven't had any success in getting them to work. phys_keepupright seems to do what I want too but it seems like a stupid way of doing it.

edit: I would like to make it collide with playerclip brushes too!

Anyone have any ideas?

my relevant code:
Code:
new pp = CreateEntityByName( "prop_physics_override" );

	SetEntityModel( pp, "models/flag/briefcase.mdl" );
	SetEntityMoveType( pp, MOVETYPE_VPHYSICS );
	SetEntProp( pp, Prop_Send, "m_CollisionGroup", 1 );
	SetEntProp( pp, Prop_Send, "m_nSolidType", SOLID_OBB_YAW );

	DispatchSpawn( pp );

	decl String:name[ 32 ];
	Format( name, sizeof( name ), "FlagPhys%d", pp );

	DispatchKeyValue( pp, "targetname", name );
	DispatchKeyValue( pp, "disableshadows", "1" );
	AcceptEntityInput( pp, "DisableDamageForces" );
	//SetEntityRenderMode( pp, RENDER_ENVIRONMENTAL );

	TeleportEntity( flag, throwFrom, NULL_VECTOR, NULL_VECTOR );
	TeleportEntity( pp, throwFrom, NULL_VECTOR, throwVelocity );

	SetVariantString( name );
	AcceptEntityInput( flag, "SetParent" );
__________________

Last edited by MikeJS; 01-14-2014 at 05:56.
MikeJS is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-14-2014 , 07:05   Re: Stopping a physprop from rolling
Reply With Quote #2

You could just use the override parameter, which is what that entity was designed for, and set the appropriate values. I think you are looking for damping or rotdamping, mabye inertia, i forget.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 01-14-2014 , 12:41   Re: Stopping a physprop from rolling
Reply With Quote #3

Then.. set the angle on TeleportEntity() once..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 01-14-2014 , 13:59   Re: Stopping a physprop from rolling
Reply With Quote #4

Quote:
Originally Posted by friagram View Post
You could just use the override parameter, which is what that entity was designed for, and set the appropriate values. I think you are looking for damping or rotdamping, mabye inertia, i forget.
Setting inertiaScale didn't seem to work, and this also seems like a crappy way of doing it...
__________________
MikeJS is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-15-2014 , 06:59   Re: Stopping a physprop from rolling
Reply With Quote #5

Override parameters https://developer.valvesoftware.com/...ysics_override
Quote:
Override Parameters <string>
A list of physics keyvalues that are usually embedded in the model. Format is key,value,key,value,...
And always, it depends what you are trying to accomplish.
Also:
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 01-15-2014 , 13:29   Re: Stopping a physprop from rolling
Reply With Quote #6

Also does not work.
__________________
MikeJS is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 01-15-2014 , 14:01   Re: Stopping a physprop from rolling
Reply With Quote #7

heres a snippet from my vehiclemod that i used to restrict vehicle rotation on certain axis, its based on the hl2 sdk code for the airboat antiflip

PHP Code:
// anti flip, not 100% effective.
    
new PhysIndex CreateEntityByName("phys_ragdollconstraint");
    
    if (
PhysIndex == -1)
    {
        
AcceptEntityInput(VehicleIndex"Kill");
        
        
PrintToServer("********** vehiclemod: could not create anti flip entity");
        return;
    }
    
    
DispatchKeyValue(PhysIndex"spawnflags""2");
    
DispatchKeyValue(PhysIndex"ymin""-50.0");
    
DispatchKeyValue(PhysIndex"ymax""50.0");
    
DispatchKeyValue(PhysIndex"zmin""-180.0");
    
DispatchKeyValue(PhysIndex"zmax""180.0");
    
DispatchKeyValue(PhysIndex"xmin""-50.0");
    
DispatchKeyValue(PhysIndex"xmax""50.0");
    
    
DispatchKeyValue(PhysIndex"attach1"TargetName);
    
    
DispatchSpawn(PhysIndex);
    
ActivateEntity(PhysIndex);
    
    
SetVariantString(TargetName);
    
AcceptEntityInput(PhysIndex"SetParent");
    
    
TeleportEntity(PhysIndexnullNULL_VECTORNULL_VECTOR); 
last time i checked SOLID_OBB_YAW wasn't implemented, also physics props will only work correctly with SOLID_VPHYSICS
blodia is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 01-15-2014 , 15:18   Re: Stopping a physprop from rolling
Reply With Quote #8

Awesome, that works nicely.

Part 2: how can I make it bounce off playerclips?
__________________
MikeJS is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-15-2014 , 15:28   Re: Stopping a physprop from rolling
Reply With Quote #9

Quote:
Originally Posted by MikeJS View Post
Awesome, that works nicely.

Part 2: how can I make it bounce off playerclips?
tryL
Code:
SetEntProp( pp, Prop_Send, "m_CollisionGroup", 5 );

Last edited by Mitchell; 01-15-2014 at 17:18.
Mitchell is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 01-15-2014 , 15:40   Re: Stopping a physprop from rolling
Reply With Quote #10

I have that already :p
__________________
MikeJS 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 16:39.


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