Garry's Mod Wiki

PhysObj:ComputeShadowControl

PhysObj:ComputeShadowControl( table shadowparams )

Description

Allows you to move a PhysObj to a point and angle in 3D space.

Arguments

1 table shadowparams
The parameters for the shadow. See example code to see how its used.

Example

Move a PhysObj to vector 0 0 0 with angles 0 0 0.

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

Page Links


Special Pages


Wikis

?

Render Time: 81ms

DB GetPage 49
Generate Html 4
SaveChanges (1) 12
Render Body 0
Render Sidebar 13