Garry's Mod Wiki

PhysObj

This is the object returned by Entity:GetPhysicsObject and Entity:GetPhysicsObjectNum.

It represents a physics object.

Methods

PhysObj:AddAngleVelocity( Vector angularVelocity )
Adds the specified velocity to the current.
PhysObj:AddGameFlag( number flags )
Adds one or more bit flags.
PhysObj:AddVelocity( Vector velocity )
Adds the specified velocity to the current.
Angle PhysObj:AlignAngles( Angle from, Angle to )
Rotates the object so that it's angles are aligned to the ones inputted.
PhysObj:ApplyForceCenter( Vector force )
Applies the specified force to the physics object. (in Newtons) This will not work on players, use Entity:SetVelocity instead.
PhysObj:ApplyForceOffset( Vector force, Vector position )
Applies the specified force on the physics object at the specified position
PhysObj:ApplyTorqueCenter( Vector torque )
Applies specified angular impulse to the physics object. See PhysObj:CalculateForceOffset
Vector, Vector PhysObj:CalculateForceOffset( Vector force, Vector pos )
Calculates the force and torque on the center of mass for an offset force impulse. The outputs can be directly passed to PhysObj:ApplyForceCenter and PhysObj:ApplyTorqueCenter, respectively.
Vector, Vector PhysObj:CalculateVelocityOffset( Vector force, Vector pos )
Calculates the linear and angular velocities on the center of mass for an offset force impulse. The outputs can be directly passed to PhysObj:AddVelocity and PhysObj:AddAngleVelocity, respectively.
PhysObj:ClearGameFlag( number flags )
Removes one of more specified flags.
PhysObj:ComputeShadowControl( table shadowparams )
Allows you to move a PhysObj to a point and angle in 3D space.
PhysObj:EnableCollisions( boolean enable )
Sets whether the physics object should collide with anything or not, including world. This function currently has major problems with player collisions, and as such should be avoided at all costs. A better alternative to this function would be using Entity:SetCollisionGroup( COLLISION_GROUP_WORLD ).
PhysObj:EnableDrag( boolean enable )
Sets whenever the physics object should be affected by drag.
PhysObj:EnableGravity( boolean enable )
Sets whether the PhysObject should be affected by gravity
PhysObj:EnableMotion( boolean enable )
Sets whether the physobject should be able to move or not. This is the exact method the Physics Gun uses to freeze props. If a motion-disabled physics object is grabbed with the physics gun, the object will be able to move again. To disallow this, use GM:PhysgunPickup.
Vector, Vector PhysObj:GetAABB()
Returns the mins and max of the physics object.
Angle PhysObj:GetAngles()
Returns the angles of the physics object.
Vector PhysObj:GetAngleVelocity()
Gets the angular velocity of the object in degrees per second.
number PhysObj:GetContents()
Returns the contents flag of the PhysObj.
number, number PhysObj:GetDamping()
Returns the linear and angular damping of the physics object.
number PhysObj:GetEnergy()
Returns the kinetic energy of the physobject.
Entity PhysObj:GetEntity()
Returns the parent entity of the physics object.
table PhysObj:GetFrictionSnapshot()
Returns the friction snapshot of this physics object. This is useful for determining if an object touching ground for example.
Vector PhysObj:GetInertia()
Returns the directional inertia of the physics object.
number PhysObj:GetInvInertia()
Returns 1 divided by the inertia.
number PhysObj:GetInvMass()
Returns 1 divided by the physics object's mass.
number PhysObj:GetMass()
Returns the mass of the physics object.
Vector PhysObj:GetMassCenter()
Returns the center of mass of the physics object as a local vector.
string PhysObj:GetMaterial()
Returns the physical material of the physics object.
table PhysObj:GetMesh()
Returns the physics mesh of the object which is used for physobj-on-physobj collision.
table PhysObj:GetMeshConvexes()
Returns all convex physics meshes of the object. See Entity.PhysicsInitMultiConvex for more information.
string PhysObj:GetName()
Returns the name of the physics object.
Vector PhysObj:GetPos()
Returns the position of the physics object.
VMatrix PhysObj:GetPositionMatrix()
Returns the position and angle of the physics object as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a rotation matrix, and the fourth column stores the position vector.
number PhysObj:GetRotDamping()
Returns the rotation damping of the physics object.
Angle PhysObj:GetShadowAngles()
Returns the angles of the PhysObj shadow. See PhysObj:UpdateShadow.
Vector PhysObj:GetShadowPos()
Returns the position of the PhysObj shadow. See PhysObj:UpdateShadow.
number PhysObj:GetSpeedDamping()
Returns the speed damping of the physics object.
number PhysObj:GetStress()
Returns the stress of the entity.
number PhysObj:GetSurfaceArea()
Returns the surface area of the physics object in source-units². Or nil if the PhysObj is a generated sphere or box.
Vector PhysObj:GetVelocity()
Returns the absolute directional velocity of the physobject.
Vector PhysObj:GetVelocityAtPoint( Vector point )
Returns the world velocity of a point in world coordinates about the object.
number PhysObj:GetVolume()
Returns the volume in source units³. Or nil if the PhysObj is a generated sphere or box.
boolean PhysObj:HasGameFlag( number flags )
Returns whenever the specified flag(s) is/are set.
boolean PhysObj:IsAsleep()
Returns whether the physics object is "sleeping". See PhysObj:Sleep for more information.
boolean PhysObj:IsCollisionEnabled()
Returns whenever the entity is able to collide or not.
boolean PhysObj:IsDragEnabled()
Returns whenever the entity is affected by drag.
boolean PhysObj:IsGravityEnabled()
Returns whenever the entity is affected by gravity.
boolean PhysObj:IsMotionEnabled()
Returns if the physics object can move itself (by velocity, acceleration)
boolean PhysObj:IsMoveable()
Returns whenever the entity is able to move.
boolean PhysObj:IsPenetrating()
Returns whenever the physics object is penetrating another physics object. This is internally implemented as PhysObj:HasGameFlag( FVPHYSICS_PENETRATING ) and thus is only updated for non-static physics objects.
boolean PhysObj:IsValid()
Returns if the physics object is valid/not NULL.
Vector PhysObj:LocalToWorld( Vector LocalVec )
Mapping a vector in local frame of the physics object to world frame. this function does translation and rotation, with translation done first.
Vector PhysObj:LocalToWorldVector( Vector LocalVec )
Rotate a vector from the local frame of the physics object to world frame. This function only rotates the vector, without any translation operation.
PhysObj:OutputDebugInfo()
Prints debug info about the state of the physics object to the console.
PhysObj:RecheckCollisionFilter()
Call this when the collision filter conditions change due to this object's state (e.g. changing solid type or collision group)
Angle PhysObj:RotateAroundAxis( Vector dir, number ang )
A convinience function for Angle:RotateAroundAxis.
PhysObj:SetAngleDragCoefficient( number coefficient )
Sets the amount of drag to apply to a physics object when attempting to rotate.
PhysObj:SetAngles( Angle angles )
Sets the angles of the physobject.
PhysObj:SetBuoyancyRatio( number buoyancy )
Sets the buoyancy ratio of the physics object. (How well it floats in water)
PhysObj:SetContents( number contents )
Sets the contents flag of the PhysObj.
PhysObj:SetDamping( number linearDamping, number angularDamping )
Sets the linear and angular damping of the physics object.
PhysObj:SetDragCoefficient( number drag )
Modifies how much drag (air resistance) affects the object.
PhysObj:SetInertia( Vector directionalInertia )
Sets the directional inertia.
PhysObj:SetMass( number mass )
Sets the mass of the physics object.
PhysObj:SetMaterial( string materialName )
Sets the material of the physobject. Impact sounds will only change if this is called on client
PhysObj:SetPos( Vector position, boolean teleport = false )
Sets the position of the physobject.
PhysObj:SetVelocity( Vector velocity )
Sets the velocity of the physics object for the next iteration.
PhysObj:SetVelocityInstantaneous( Vector velocity )
Sets the velocity of the physics object.
PhysObj:Sleep()
Makes the physics object "sleep". The physics object will no longer be moving unless it is "woken up" by either a collision with another moving object, or by PhysObj:Wake. This is an optimization feature of the physics engine.
PhysObj:UpdateShadow( Vector targetPosition, Angle targetAngles, number frameTime )
Unlike PhysObj:SetPos and PhysObj:SetAngles, this allows the movement of a physobj while leaving physics interactions intact. This is used internally by the motion controller of the Gravity Gun , the +use pickup and the Physics Gun, and entities such as the crane. This is the ideal function to move a physics shadow created with Entity:PhysicsInitShadow or Entity:MakePhysicsObjectAShadow.
PhysObj:Wake()
Wakes the physics object. See PhysObj:Sleep for more information.
Vector PhysObj:WorldToLocal( Vector vec )
Converts a vector to a relative to the physics object coordinate system.
Vector PhysObj:WorldToLocalVector( Vector WorldVec )
Rotate a vector from the world frame to the local frame of the physics object. This function only rotates the vector, without any translation operation.

Page Links


Special Pages


Wikis

?

Render Time: 30ms

DB GetPage 4
Generate Html 3
SaveChanges (1) 8
Render Body 0
Render Sidebar 12