Jump to content

Recommended Posts

Posted

The default suspensionlength in the headers will be half of the tire radius, as suggested by Josh.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Do you guy's know if this will work with LEO in c++.

 

I just started using LEO, and i'm not sure if LEO needs

 

to be updated also, or if it can be ported to LEO ?

 

It's working great with C though, just not sure how to set it up in LEO.

 

Thank's for any info.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Posted

Hi, here is a LEO vehicle example, if anyone is interested:

 


#include "leo.h"

using namespace LEO ;

float steerangle=0.0;

int main( int argn, char* argv[] )
{
Engine engine( "leocar", 1280, 800 ) ;
Engine::SetAbstractPath( "C:/Leadwerks Engine SDK" ) ;
Engine::SetFilters() ;

World world( CREATENOW ) ;
if( !world.IsValid() ) 
{
	MessageBoxA(0,"Error","Failed to create world.",MB_OK);
	return engine.Free() ;
}

Buffer gbuffer( Engine::GetWidth(), Engine::GetHeight() );

Camera camera( CREATENOW );
camera.SetPosition( 0, 0, -10 );

Material material("abstract::cement_asphaltscales-01_df_.mat") ;

//DebugPhysics();

DirectionalLight light( CREATENOW ) ;
light.SetRotation( 45 , 45, 45 );

SetWorldGravity(Vec3(0, -20, 0));
LEO::Collisions::Set(1,1,SLIDINGCOLLISION);

// Vehicle
Model chassis;
chassis.Load("abstract::impreza.gmf", 0); 
chassis.SetType(1);
chassis.SetMass(10);

Mesh tire[4];
tire[0].Load("abstract::vehicle_monstertruck_tire_left.gmf", 0);
tire[1].Load("abstract::vehicle_monstertruck_tire_right.gmf", 0);
tire[2].Load("abstract::vehicle_monstertruck_tire_left.gmf", 0);
tire[3].Load("abstract::vehicle_monstertruck_tire_right.gmf", 0);

RotateMesh(tire[0],Vec3(0,0,90));
   RotateMesh(tire[1],Vec3(0,0,90));
   RotateMesh(tire[2],Vec3(0,0,90));
   RotateMesh(tire[3],Vec3(0,0,90));

Vehicle veh;
veh.Create(chassis);

veh.AddTire(Vec3(-1.4,0,1.4),0.5,1.0,80,200);
veh.AddTire(Vec3(1.4,0,1.4),0.5,1.0,80,200);
veh.AddTire(Vec3(-1.4,0,-1.4),0.5,1.0,80,200);
veh.AddTire(Vec3(1.4,0,-1.4),0.5,1.0,80,200);

BodyBox groundbody( 100, 1, 100 ) ;
Cube ground( CREATENOW ) ;
ground.SetScale( 100, 1, 100 );
groundbody.SetParent( ground ) ;
ground.SetPosition( 0, -3, 0 );
ground.Paint( material ) ;
groundbody.SetType(1);

// Game loop
while( !Keyboard::I****() && !Engine::IsTerminated() )
{
	if( !Engine::IsSuspended() ) 
	{

		// Steering
		if (KeyDown(KEY_LEFT) && (steerangle<=40.0f)) {
			steerangle+=1.0f;
			SetSteerAngle(veh, steerangle, 0);
			SetSteerAngle(veh, steerangle, 1); }

		if (KeyDown(KEY_RIGHT) && (steerangle>=-40.0f)) {
			steerangle-=1.0f;
			SetSteerAngle(veh, steerangle, 0);
			SetSteerAngle(veh, steerangle, 1); }

		// Torque
		AddTireTorque(veh, 0, -1);
		if (KeyDown(KEY_UP)) AddTireTorque(veh, 10, -1); 
		if (KeyDown(KEY_DOWN)) AddTireTorque(veh, -10, -1); 

		if (KeyDown(KEY_SPACE)) AddBodyForce(chassis, Vec3(0,200,0), 1); // Lift car

		SetEntityMatrix(tire[0],veh.GetTireMatrix(0));
           SetEntityMatrix(tire[1],veh.GetTireMatrix(1));
           SetEntityMatrix(tire[2],veh.GetTireMatrix(2));
           SetEntityMatrix(tire[3],veh.GetTireMatrix(3));

		Engine::UpdateTime();
		World::Update( Engine::GetSpeed()) ;

		gbuffer.Set();
		World::Render() ;
		Engine::GetBackBuffer().Set() ;
		World::RenderLights(gbuffer);

		Engine::Flip() ;
	}
}

return engine.Free() ;
}

 

I used the monstertruck tires from LE 2.3 SDK, because i can't get the

 

wheel textures to show up on the car wheels. :)

 

I removed the engine.dll, newton.dll, and shaders.pak from release dir.

 

And i removed the engine.cpp, and leo.cpp from the project.

 

Link to leocar.zip project: http://66.244.240.14/

 

Link isn't always up.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Posted

I forgot the cement_asphaltscales-01_df_.mat file,

 

but you can just add your own texture.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Posted

You will need the recompiled engine.dll Josh posted on this thread.

Win 7 64, LE 2.31, Liquid Cooled I7-960 @ 4.00GHz, 6GB DDR3 Ram @ 1600mhz, BFG GTX295, Sound Blaster X-FI.

Posted

Hi all,

 

Good job Josh, and thanks to all to gave me some light to vehicle implentation.

I've to try yet, but i've a problem, VS 2008, doesn't recognise some identifiers like Framework, some phy functions, etc... My question is, I'm missing something?(any dll, or whatever) I can't understand it. I do what the Video tutorial "Setting Up VS 2008 c++ Express Edition" tells.

 

Pls help.

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