PhysObj.ComputeShadowControl

From GMod Wiki

Jump to: navigation, search
Function
Syntax PhysObj:ComputeShadowControl( Table values )
Description:
Allows you to do smooth movement to points/angles
Returns: nil
In Object: Physobj
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=PhysObj.ComputeShadowControl]PhysObj.ComputeShadowControl [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionMove object to 0,0,0 with 0,0,0 angles
Used onNewerServer.png
Code
function ENT:Initialize()
 
	self:StartMotionController()
	self.ShadowParams = {}
 
end
function ENT:PhysicsSimulate( phys, deltatime )
 
	phys:Wake()
 
	self.ShadowParams.secondstoarrive = 1 // How long it takes to move to pos and rotate accordingly - only if it _could_ move as fast as it want - damping and max speed/angular will make this invalid (Cannot be 0! Will give errors if you do)
	self.ShadowParams.pos = Vector( 0, 0, 0 ) // Where you want to move to
	self.ShadowParams.angle = Angle( 0, 0, 0 ) // Angle you want to move to
	self.ShadowParams.maxangular = 5000 //What should be the maximal angular force applied
	self.ShadowParams.maxangulardamp = 10000 // At which force/speed should it start damping the rotation
	self.ShadowParams.maxspeed = 1000000 // Maximal linear force applied
	self.ShadowParams.maxspeeddamp = 10000// Maximal linear force/speed before  damping
	self.ShadowParams.dampfactor = 0.8 // The percentage it should damp the linear/angular force if it reaches it's max amount
	self.ShadowParams.teleportdistance = 200 // If it's further away than this it'll teleport (Set to 0 to not teleport)
	self.ShadowParams.deltatime = deltatime // The deltatime it should use - just use the PhysicsSimulate one
 
	phys:ComputeShadowControl(self.ShadowParams)
 
end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox