Jump to content

GetName entity???


Yue
 Share

Go to solution Solved by brndx,

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...