Yue Posted July 13, 2018 Share Posted July 13, 2018 I have four tires, a script that is used on all four tires to set the suspension and hinge for the engine of each tire. My question is, how do I retrieve the name of that entity associated with that script? it's with the goal of only setting the engine for two tires. Any suggestions? -- Script Spring. Script.chassis = nil --entity "Chassis" Script.llanta = nil --entity "Llanta" --Spring local suspension -- motor local motor function Script:Start() --Slider. suspension = Joint:Slider(self.entity:GetPosition().x, self.entity:GetPosition().y, self.entity:GetPosition().z, 0, 1, 0, self.entity, self.chassis ) suspension:EnableLimits() suspension:SetLimits(-0.01,-0.05 ) --Hinge. motor = Joint:Hinge( self.llanta:GetPosition().x, self.llanta:GetPosition().y, self.llanta:GetPosition().z, 0, 0, 1, self.llanta, self.entity ) motor:DisableLimits() end function Script:UpdateWorld() if self.entity:GetKeyValue("type", "") == "Suspension0" then self.llanta:Hide() --motor:SetAngle( motor:GetAngle()+100) --motor:EnableMotor() --motor:SetMotorSpeed(1000) end end Quote Link to comment Share on other sites More sharing options...
Solution brndx Posted July 13, 2018 Solution Share Posted July 13, 2018 if tostring(self.entity:GetKeyValue("name")) == "Suspension0" then 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.