Jump to content
Leadwerks Community

Shock absorbers have a strange behavior


Go to solution Solved by Josh,

Recommended Posts

Posted

How can I avoid this behavior?
 

Script Lua.


 

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




function Script:Start()
	
	
    self.posAmortiguador = self.entity:GetPosition()
	
	
	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)
	
	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


local vel = 0
function Script:UpdateWorld()
	
	self.Motor:DisableMotor()
	if window:KeyDown(Key.W) then 
	
	  self.Motor:EnableMotor()
	  self.Motor:SetAngle( self.Motor:GetAngle() - 100 ) 
	
	  
		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 


	self.Motor:SetMotorSpeed( vel ) 

	
end

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

  • Solution
Posted

You can see that since you are using a motor instead of a spring, the correction force is constant. A spring would increase the force as it gets further from the equilibrium point. I will be looking at the spring damper soon to see if we can minimize bouncing / harmonics.

  • Like 1

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

Posted
11 hours ago, Josh said:

You can see that since you are using a motor instead of a spring, the correction force is constant. A spring would increase the force as it gets further from the equilibrium point. I will be looking at the spring damper soon to see if we can minimize bouncing / harmonics.

I'm telling you that if he didn't activate the engine, he's still bouncing the tires a lot, even if he puts a value of 1 in the spring. 

I'm going to make a video to explain it better, the thing is that the translator doesn't help me much.  

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted
1 hour ago, Yue said:

Here video. 

I believe you. Newton has three parameters for the spring. I only exposed one and automatically filled in the other two. Obviously I need to expose all three.

  • Thanks 1

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

Posted

Thank you, the truth is that the translator is often a real problem.

Spring to Spanish equals "Primavera"

"Primavera" in Spanish I understand is a time of year, along with winter, fall and summer.  That's why I think the best way is to make the videos. 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted
2 minutes ago, Josh said:

¿Elástico? ¿Eso tiene más sentido?

metal-spring-500x500.jpg.489d18a5d7a8634019ca7686058f6e73.jpg

If perfect, I have understood it by force, try after try, a spring, the same happens with certain words, for example Handle tells me that it is a green tropical fruit. I suppose everything would be easier if he spoke English, but I think that with the persistence I already have a car system that I imagined impossible before, and it all started with your suggestion of springs, sliding joints and hinge joints.  

Translated with www.DeepL.com/Translator

  • Haha 1

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...