Jump to content
Yue

The laboratory

Recommended Posts

The "holidays" came, everyone at their New Year's Eve parties and I like any month of the year, trying to survive. 

I have resumed the project of the forklift, but this time with another engine that reacts correctly to my computer that has suffered collateral damage, a hard drive 500 gigas step to better life with a memory of 2 gigas. So it's not much that can run but a simple engine like BlitzMax. 

The project involves getting the forklift running again, but the interesting thing is that with what I learned in leadwerks, on joints, I already have the front suspensions of the forklift along with the hinge system to turn those tires. So while I'm finding a job I guess I'll be doing the forklift, to see if I've made any progress in my performance of creating a project, in the sense of organization and workflow. 

Translated with www.DeepL.com/Translator

MC.png.f3856c8e20c409723a9b7f4d6f348c4d.png

  • Upvote 1

Share this post


Link to post

 



All right, I got the suspension for the forklift tires.  I'm not looking to make a game, the fun is to improve my skills and understand how things work. 

Share this post


Link to post

 

 

And here we have the engine test, obviously it looks good, a lot of suspension for this kind of vehicle, but that can be fixed. However, the mistake I have now and it has made me think, is that if I want to change the rotation of the chassis during the game, just rotate the chassis and not the tires, that makes me thoughtful.

 

Share this post


Link to post

With the new best in Leadwerks for version 4.6 my mouth is watering to use it, but unfortunately my computer is not in the best possible condition, two gigas in ram is not enough in windows 10 and Leadwerks closes inseperately after a while, so I will continue here while I see who can sell me a board with better features, that if and count if I have the money. 

Well, I continue with the joints, in this case better accommodating the code to create a spring joint. 

Translated with www.DeepL.com/Translator

854259927_JointSpreen.png.76624039de14f6c4611187edc4e313f0.png

 

 

Local cubo:TMesh = TMesh.Init()
cubo.AddBoxShape(1)
cubo.SetColor(255,0,0)
cubo.SetPosY(0.1)
cubo.SetScale(5,0.2,5)

Local cubo2:TMesh = TMesh.Init()
cubo2.AddBoxShape(1)
cubo2.SetColor(255,255,0)
cubo2.SetPosY(1)

cubo2.CreateD6SpringJoint(cubo.ente,0,-2.0,0, 0,2,0, False, False )
JointD6SetAngularLimits( cubo2.joint, 0,0,0, 0,0,0)
JointD6SetLimits( cubo2.joint, 1, -1, 1)
JointDisableCollisions(cubo2.joint,1 )
JointD6SpringSetParam( cubo2.joint, 1, True, 200, 50 )

 

Share this post


Link to post

To avoid the collision calculation being made on the chassis of the forklift that has about five thousand polygons, I'm creating a simplified version of the chassis to create the body that collides, this means gaining a little performance. 

Collision.thumb.png.c3bc7106226989d63a1cb1ba65a59b95.png

Share this post


Link to post

The result of the optimization. :D

Optimizar.thumb.png.3a6298e4702d3e3045be14d3552be215.png

 

 


Type TVehiculo

	Field chassis:TMesh 
	Field pxChassis:TMesh
	Field resorte:Int[4]
	Field ejeResorte:TMesh[4]
	Field motorRueda:Int[4]
	Field motorDir:Int[2]
	Field rueda:TMesh[4]
	Field ejeDir:TMesh[2]
	
	Function Init:TVehiculo()
	
		Local veh:TVehiculo = New TVehiculo
		
			veh.Load()
			Return veh
	
	End Function
	
	Method Load()
		
		Self.chassis   = TMesh.Init("Chassis.x")
		Self.pxChassis = TMesh.Init("ChassisPx.obj")
		Self.chassis.AddConcaveShapeProxy(Self.pxChassis.ente)
		Self.pxChassis.Free()
	
	End Method 
	
End Type


 

Share this post


Link to post

The collision of the tires, has improved, it is no longer just a ray, but a type of collision a little more like reality. 
ColLlantas.png.ce972c8382c9ee0b968187ee327f452b.png

Type TVehiculo
	Field chassis:TMesh 
	Field pxChassis:TMesh
	Field rueda:TMesh[4]
	Field motorDir:Int[2]
	Field resorte:Int[4]
	Field ejeResorte:TMesh[4]
	Field motorRueda:Int[4]

	Field ejeDir:TMesh[2]
	
	Function Init:TVehiculo()
	
		Local veh:TVehiculo = New TVehiculo
		
			veh.Load()
			Return veh
	
	End Function
	
	Method Load()
		
		' Chassis.
		Self.chassis   = TMesh.Init("Chassis.x")
		Self.pxChassis = TMesh.Init("ChassisPx.obj")
		Self.chassis.AddConcaveShapeProxy(Self.pxChassis.ente)
		Self.pxChassis.Free()
		Self.chassis.SetAlpha(0.5)
		Self.chassis.SetPosY(5)
		' Ruedas.
		For Local l:Byte = 0 To Self.rueda.length - 1
			Self.rueda[l] = TMesh.Init("Llanta" + l + ".b3d")
			Self.rueda[l].AddConvexShape()
		Next 
		
	End Method 
	

 

Share this post


Link to post

question what engine you using right now for this

plus what motherboard does your computer has.

Share this post


Link to post

Hi, thanks for your question. I'm using BlitzMax + Xors3D. 

The board is a https://www.asrock.com/mb/Intel/Wolfdale1333-D667 R2.0/index.la.asp

At the moment I have 2 gigas of ram and a hard disk of 80 gigas, it has touched me to connect two memories usb to the ports, each one of four gigas, apparently improves the general performance of Windows 10. Equally I have uan Nvidia gtx 1050 Pny.  The processor is an E8400 Intel Duo. 3.0

Translated with www.DeepL.com/Translator

Share this post


Link to post

ok i can see it can take 2x 2gb ddr2 memory to give you 4gb 

after that you will need new board and a new cpu and new memory 

as now day it ddr4 memory used. i do have a few spare board cpu and memory that ddr3 lol

but am uk 

Share this post


Link to post
33 minutes ago, carlb said:

ok puedo ver que puede tomar 2 x 2 gb de memoria ddr2 para darle 4 gb 

Después de eso, necesitará una nueva placa, una nueva CPU y una nueva memoria. 

Como hoy día se usó la memoria ddr4. Tengo algunos cpu y memoria de placa de repuesto que ddr3 lol

pero soy uk 

I'm from Colombia, I told you that the processor I currently have was given to me a few years ago by someone named Derron from the disappeared community of Blitz3D. 

I think that the processor because it is small the shipment has not come out so expensive, but if they are bigger things than that, I think it comes very expensive shipping. 

The board only supports four gigas, but with the connection of the two usb to the ports improves a bit the performance. 

I've thought about changing the entire motherboard for a second one, to have more memory, but also here these technological products are very expensive. 

Well, I continue to make progress in this, I'm putting correctly the rigid bodies for the springs, in the first prototype had a spaghetti code, and the idea is to have everything a little more organized so that this does not get out of hand

Translated with www.DeepL.com/Translator

EjesResorte.png.898a051fc54ef3543dea6c01f1bbae8a.png


 

Type TVehiculo

	Field chassis:TMesh 
	Field pxChassis:TMesh
	Field rueda:TMesh[4]
	Field ejeResorte:TMesh[4]
	Field resorte:Int[4]
	Field motorDir:Int[2]
	Field motorRueda:Int[4]
	Field ejeDir:TMesh[2]
	
	Function Init:TVehiculo()
	
		Local veh:TVehiculo = New TVehiculo
		
			veh.Load()
			Return veh
	
	End Function
	
	Method Load()
		
		' Chassis.
		Self.chassis   = TMesh.Init("Chassis.x")
		Self.pxChassis = TMesh.Init("ChassisPx.obj")
		Self.chassis.AddConcaveShapeProxy(Self.pxChassis.ente,0)
		Self.pxChassis.Free()
		Self.chassis.SetAlpha(0.4)
		Self.chassis.SetPosY(3)
		' Ruedas.
		For Local l:Byte = 0 To Self.rueda.length - 1
			Self.rueda[l] = TMesh.Init("Llanta" + l + ".b3d")
			Self.rueda[l].AddConvexShape()
		Next 	
		Self.InitResortes()		
	End Method 
	
	Method InitResortes()
	
		' Ejes de los resortes.
		For Local r:Byte = 0 To Self.ejeResorte.length -1 
				
			Self.ejeResorte[r] = TMesh.Init()
			Self.ejeResorte[r].SetColor(255,128,0)
			Self.ejeResorte[r].SetScale(0.2,0.02,0.02)
			Self.ejeResorte[r].AddBoxShape(0)
			Self.ejeResorte[r].SetFX(1)	
		Next 
		
		' Posiciíon de los ejes.
		Self.ejeResorte[0].SetPosY(2.8)
		Self.ejeResorte[0].SetPosX(-0.5)
		Self.ejeResorte[0].SetPosZ(0.9)
		
		Self.ejeResorte[1].SetPosY(2.8)
		Self.ejeResorte[1].SetPosX(0.5)
		Self.ejeResorte[1].SetPosZ(0.9)
		
		Self.ejeResorte[2].SetPosY(2.8)
		Self.ejeResorte[2].SetPosX(0.5)
		Self.ejeResorte[2].SetPosZ(-0.6)
		
		Self.ejeResorte[3].SetPosY(2.8)
		Self.ejeResorte[3].SetPosX(-0.5)
		Self.ejeResorte[3].SetPosZ(-0.6)

	End Method
	
	
End Type


 

Share this post


Link to post

This is the result of putting the springs in their respective positions.  In motor debug mode I have some spheres where it is necessary to limit their angular limits in their three axes so that those spheres disappear.

Spring.png.513dd6afa0a47ba163586b5decd66ce9.png

 

The strange thing about it is that I have to find a way so that these spring bodies don't collide with either the forklift body or the tires. In the first prototype I did this by making these bodies very small, but it is not that it was very viable, because at some point when moving the direction of the tires these blocked part of the movement of the vehicle. 
 

		For Local x:Byte = 0 To Self.resorte.length -1
			Self.ejeResorte[x].CreateD6SpringJoint(Self.chassis.ente, 0,0,0,  0,0,0,  False,False)
		Next 
		

 

Share this post


Link to post

Okay, I've got this under control. :D

ow trying to solve puzzles of how to do one thing, the other, and improve. I've always told people who tell me why I don't make a game, and I tell them that it's like solving a crossword puzzle, at some point I run into something I can't solve, I leave it and then take it back with a fresh mind, of course that means sending work to oblivion, I think it's an excuse, but with time things get better and it becomes more fun. 

Share this post


Link to post

 

I've found a way for certain rigid bodies not to collide with others. For example, the rims do not collide with the chassis or the axle of the wheels, where the spring and the hinge joint are established. 

And here goes the best structured code that gives my head. 
https://paste.ofcode.org/34XJZpmUyKTmtG6uSYLngXq


LlantasF.png.8aa86e4a78c0f67b9461a4ba0c9bd4cc.png

Although the front wheels are in the correct position, it does not yet have the suspension parameters set. For now it is only rigid, and the idea is that the suspension on this type of vehicle is very minimal. 


 

Share this post


Link to post

Program structure.

 

image.thumb.png.3fd7a7a27d15e7038662d681e0208da7.png

image.thumb.png.a24d9fcc4fab23077718d30cc17b4b2a.png

FPSLow.png.f4940078082d3a5b5c7c1e406df5a508.png

nevitably I have come across the most feared problem, low FPS. Possibly it's because the hard drive is always working in the background, but no idea what it could be, it only happens when I move the camera away from a certain distance, and eventually this is not very animating if I put more entities on stage. 
 

Share this post


Link to post

Creating the hinges for steering the rear wheels of the forklift. 

The next thing is to limit their angle of rotation, and hook the rims with another hinge joint. 

Dir.png.a6be38e4256df7bb4dd106a231e40cd5.png

Share this post


Link to post

The nightmare error has been fixed. Because if I tried to rotate the vehicle and give it a new position somewhere else, we had this. 

 

image.png.43e651cf60c00ed3539e7b56a701e8f5.png

 

By now I have the tires correctly in place, it's scary to look inside the code to do this, but it's usually fun, I hope to have everything under control. 

image.png.223cfc0f41dd127ef451b2d54507e1ce.png

The next step is to establish the ideal configuration for the tires with their springs, tire steering, and engine to move the vehicle.  The litmus test really is when you want to implement the shovel and lift a hollow pallet, that will depend on the end of this prototype of forced vacations. 

code here: 
https://paste.ofcode.org/98YxbjP8RN8REtpY3ArhSe

Share this post


Link to post

Well, I've tried every possible configuration for the springs, as rigid as possible for a vehicle like this. I guess it's not perfect, but happy with the result. 

On the wheels, I have two options to implement the engine system, one is to apply torque directly to the tires, and the other is the engine system of the hinge joints, porbare with both to see how it is. 

 

 

 

 

 

 

Share this post


Link to post

G.png.05bd014d14ae6b5675c0d86edee633ab.png

Well, we're still at it. Giving solution to certain aspects to improve things. 

The problem was that when creating the vehicle system, all its elements when loaded were positioned in a single coordinate, so when applying rigid bodies these elements have to be positioned in different parts of the vehicle, tires, chassis, suspension axles etc..  This caused the vehicle to initially jump through the air while creating its physical parts.  

The solution to this was to load the models or create them in their respective position to the vehicle by relating parents and children in a hierarchy so that this does not happen.  

On engine testing, I have speed and engine power, interesting aspect when working with the joint hinges, and I think it is the most viable thing to apply torque directly to the tires, or recover its angle and assign a new one. 

Translated with www.DeepL.com/Translator

https://paste.ofcode.org/B7BeDU2aCgiZtXaZrbPRJJ

https://paste.ofcode.org/t5XDTBQLcDEuuwjkRhx4Ww
 

 

Share this post


Link to post

All right, test and engine all four tires using hinge joints. 

 

Global vel:Float
	Global motorOn: Byte = False
	Method UpdateMotor()

	
		If xKeyDown(xKEY_Q) Then 
			motorOn = True 
			If vel < 10.0 Then 
				vel = vel +0.5 
			End If 
		
		Else If xKeyDown(xKEY_E) Then 
			motorOn = True
			If vel > -5.0 Then 
				vel = vel - 0.5
			End If 
		
		Else If xKeyDown(xKEY_SPACE) Then 
			motorOn = True

			vel = 0.0	
			 
		Else 
		
			motorOn = False
	
					
		End If 

		Self.ejeRueda[0].JointEnableMotor(motorOn, vel,1)
		Self.ejeRueda[1].JointEnableMotor(motorOn, vel,1)
		Self.ejeDir[0].JointEnableMotor(motorOn, vel,1)
		Self.ejeDir[1].JointEnableMotor(motorOn, vel,1)
		
	End Method

 

Share this post


Link to post

image.png.cf08bd0096888b54b56d8f14c60d68d8.png

Working on the forklift steering system.  One thing I have noticed is that the more you repeat the same process, the more control you have over it. When I first got to know the Leadwerks union system, and when I repeat it over and over again, it's where we become experts, well that's what I think. 

When I finish the above then I go to the shovel to lift boxes, if this works as I hope I will have a very nice prototype.  

Translated with www.DeepL.com/Translator

Share this post


Link to post

Tire steering test, nice results. Nothing of the other world, for me a real challenge. 
 


 

Method UpdateDirMotor()
	
		
	
	
			If xKeyDown(xKey_L) Then 
					Self.ejeRueda[2].JointHingeSetMotorTarget(Self.ejeRueda[2].JointHingeGetAngle() + 10,0.1)
					Self.ejeRueda[3].JointHingeSetMotorTarget(Self.ejeRueda[3].JointHingeGetAngle() + 10,0.1)
				
			ElseIf xKeyDown(xKey_K) Then 
			
					Self.ejeRueda[2].JointHingeSetMotorTarget(Self.ejeRueda[2].JointHingeGetAngle() - 10,0.1)
					Self.ejeRueda[3].JointHingeSetMotorTarget(Self.ejeRueda[3].JointHingeGetAngle() - 10,0.1)
			Else 
			
					Self.ejeRueda[2].JointHingeSetMotorTarget(0,0.1)
					Self.ejeRueda[3].JointHingeSetMotorTarget(0,0.1)


			
			End If 	
	
		
		
			
	
	End Method
	

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Create Your Account

Sign in

Already have an account? Sign in here.

Sign In Now
×