Jump to content
Leadwerks Community

[Solved ]Tire steering tips ?


Go to solution Solved by Josh,

Recommended Posts

Posted

 

I want to implement wheel steering, however my attempts are unsuccessful, as I have put two additional pivots on the springs on the front tires, and created hinge joints but blocked the movement of the tires when moving the vehicle. Any suggestions are welcome. 

 

image.png.a7306442455af1cbfe4d5e0ee3ec9837.png

Script.rueda = nil --entity "Rueda"  --Wheels
Script.chassis = nil --entity "Chassis" -- Chassis




function Script:Start()
	
	MotorVehiculo(self)
    
	
	
	
	
end


local vel = 0
function Script:UpdateWorld()
	
	

	self.Motor:DisableMotor()
	
	
	if window:KeyDown(Key.W) then 
	
	
	
		--if tostring(self.entity:GetKeyValue("name")) == "Susp2" then  
	
	
	
			self.Motor:EnableMotor()
			self.Motor:SetAngle( self.Motor:GetAngle() - 100 ) 
	  -- end
	  
		if vel <=500 then 
			vel = vel + 10 
	
		end 
	

	
	
	
	
	end 
	
	
	
  if window:KeyDown(Key.S) then 
	
	  self.Motor:EnableMotor()
	  self.Motor:SetAngle( self.Motor:GetAngle() + 100 ) 
	
	  
		if vel <=500 then 
			vel = vel + 10 
	
		end 
	

	
	
	
	
	end 
	
	
	if window:KeyDown(Key.Space ) then 
	
	
		self.Motor:EnableMotor()
		vel = 0 
	
	end 


	self.Motor:SetMotorSpeed( vel ) 
	
	
	if window:KeyHit(Key.J) then
	
	
		self.chassis:AddForce( 0, 5000*3, 0 ) 
	
	end 

	
end


function MotorVehiculo(self)

self.posAmortiguador = self.entity:GetPosition()
	
	--Spring
	self.Amortiguador    = Joint:Slider(self.posAmortiguador.x, self.posAmortiguador.y, self.posAmortiguador.z, 0,1,0, self.entity, self.chassis)
	
	--self.Amortiguador:SetSpring(200 )
	
	self.Amortiguador:EnableLimits()
	
	self.Amortiguador:SetLimits( 0, 0.01) 
	self.Amortiguador:EnableMotor()
	self.Amortiguador:SetTargetAngle(0)
	
	--Hinge / Motor Wheels
	self.posMotor        = self.rueda:GetPosition()
	self.Motor           =  Joint:Hinge( self.posMotor.x, self.posMotor.y, self.posMotor.z, 0, 0, 1, self.rueda, self.entity ) 
	self.Motor:DisableLimits()
	
	self.rueda:SetPickMode( 0 )
	self.entity:SetPickMode( 0 ) 
	
	self.rueda:SetFriction(1, 1 ) 

end 

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

  • Solution
Posted

It will work. The wheels with steering need an additional pivot between the suspension pivot and the wheel. This pivot uses a hinge joint with an axis of (0,1,0). The motor for this joint should be enabled at all times, and you just set the target angle to control the steering.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted
19 hours ago, Josh said:

It will work. The wheels with steering need an additional pivot between the suspension pivot and the wheel. This pivot uses a hinge joint with an axis of (0,1,0). The motor for this joint should be enabled at all times, and you just set the target angle to control the steering.



ok?

 

image.png.573253675c0b4f6f9ec8600c0795575f.png

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted

This continues without working, in which case, the steering axle ("pivot") is the one that moves and not the rim. I welcome any suggestions.

 

Script.rueda = nil --entity "Rueda"  --<<< Wheel Dir

-- This script atach pivot dir.



function Script:Start()
	
	
	self.volante = self.rueda:GetPosition()
	self.dir = Joint:Hinge( self.volante.x, self.volante.y, self.volante.z, 0, 1, 0,  self.entity, self.rueda ) 
	self.dir:DisableLimits()
	
	
end



function Script:UpdateWorld()
	
	self.dir:SetAngle( self.dir:GetAngle() + 100 ) 
	self.dir:EnableMotor()
	self.dir:SetMotorSpeed(1000)
	
	
end

image.thumb.png.0183fcd3bbeba24543d9ac66f02d2a9f.png

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted

 

It is now possible to turn the rim, but it does not roll with the engine drive. :(

 

Script.rueda = nil --entity "Rueda" -- Wheel
Script.susp = nil --entity "Susp" -- Spring



function Script:Start()
	
	
	self.volante = self.entity:GetPosition()
	self.dir = Joint:Hinge( self.volante.x, self.volante.y, self.volante.z, 0, 1, 0,  self.susp, self.rueda ) 
	self.dir:DisableLimits()
	--self.dir:SetLimits(-35, 35 ) 
	
end



function Script:UpdateWorld()
	
	self.dir:SetAngle( self.dir:GetAngle() + 100 ) 
	self.dir:EnableMotor()
	self.dir:SetMotorSpeed(10)
	
	
end

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted

The following diagram shows how I have implemented the chassis, and the movement of the tire but I have no idea how to put in an additional pivot for the steering. 


image.thumb.png.598205c97be9205b4a7063d19dbb9244.pngsdf

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

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.

×
×
  • Create New...