Jump to content
Leadwerks Community

Recommended Posts

Posted
function Script:Start()
	
	
-- Creando Vehiculo.
 vehiculo = Vehicle:Create(self.entity )

 
if vehiculo:Build()==false then Debug:Error("Failed to build vehicle.") end






end




I'm trying to create a vehicle system, but I haven't been successful. Any suggestions? A simple example? What am I doing wrong.

Greetings.


 

MC.png

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted

Just in case you do not realize, but there is a search function built into the forum. I think you will find it helps answer a lot of questions. The following are from just typing 'vehicle' into the search... note that vehicles have been in the process of being reworked for quite awhile now and may not be stable.

 

  • Thanks 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

Yes, I solved the problem, turn the model from blender and I already have it.

However, I have another inconvenience, and that is that the suspension is very high, when the vehicle does not touch the ground, the tires go down a lot from the chassis.

Something tells me that I have to make the model of the vehicle bigger, but I don't rule out the possibility that there is a parameter so that the suspension is not so long. Any suggestions?

 

function Script:Start()
	

	
 --Create the vehicle chassis
        chassis = self.entity
    

	
       

    
        chassis:SetPosition(0,5,0)


--Create the vehicle
        vehicle = Vehicle:Create(chassis)
        
        --Add tires
        local tireradius=0.35
        local tiremass=100
        local tirewidth=0.5
        local tireheight=-0.35
        local tirespacing=0.5
		
		local damper =2.0
		local damper2 = 500
	    local damper3 = 500


        tiremodel={}
        
        tiremodel[0]=self.llanta1
	
       
        tiremodel[0]:SetPosition(tirespacing,tireheight,0.9)
        vehicle:AddTire(tirespacing,tireheight,0.9,tiremass,tireradius,tirewidth,true)
        
        tiremodel[1]=self.llanta2
        tiremodel[1]:SetScale(tireradius*2,tirewidth,tireradius*2)
        
        tiremodel[1]:SetPosition(-tirespacing,tireheight,0.9)
        vehicle:AddTire(-tirespacing,tireheight,0.9,tiremass,tireradius,tirewidth,true)
        
        tiremodel[2]=self.llanta3
        tiremodel[2]:SetScale(tireradius*2,tirewidth,tireradius*2)
      
        tiremodel[2]:SetPosition(tirespacing,tireheight,-0.7)
        vehicle:AddTire(tirespacing,tireheight,-0.7,tiremass,tireradius,tirewidth,false)
        
        tiremodel[3]=self.llanta4
        tiremodel[3]:SetScale(tireradius*2,tirewidth,tireradius*2)
      
        tiremodel[3]:SetPosition(-0.5,tireheight,-0.7)
        vehicle:AddTire(-tirespacing,tireheight,-0.7,tiremass,tireradius,tirewidth,false)       
        
        --Add axles
        vehicle:AddAxle(0,1)
        vehicle:AddAxle(2,3)
        
        --Finalize the vehicle
        if vehicle:Build()==false then Debug:Error("Failed to build vehicle.") end


  --Start the engine
        vehicle:SetEngineRunning(true)
        
        --Release the emergency brake
        vehicle:SetHandBrakes(0)

end

MC.png

  • Confused 1

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted

Suspensionlength...all the little problems you are running into are actually kind of funny when you read the whole thread.  :D

  • Haha 1

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

Posted
16 hours ago, Josh said:

Suspensionlength...all the little problems you are running into are actually kind of funny when you read the whole thread.  :D

Hello, now what happens is that I have the vehicle that rebounds a lot, any suggestions?

 

local damper = 10
    local spring = 100
	local dist   = 0.001

	

	montaCarga:AddTire( -ejePos, -ejeAlt, posZ, 10, radio, ancho, false, damper, spring, dist)
	montaCarga:AddTire(  ejePos,  -ejeAlt, posZ, 10, radio, ancho, false, damper, spring, dist)
	montaCarga:AddTire( -ejePos, -ejeAlt, -posZ+0.3, 10, radio, ancho,false, damper, spring, dist)
	montaCarga:AddTire( ejePos, -ejeAlt, -posZ+0.3, 10, radio, ancho,false, damper, spring, dist)



 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Posted
31 minutes ago, Josh said:

Adjust the spring value.

It wasn't working, so after testing I increased the mass of the tires and it's working. 

Another question, how do I establish the car's center of mass?

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

  • 2 weeks later...
Posted

You should not need to, it will work out the mass center itself, assuming uniform density.

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

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