Jump to content

How to create chassis and wheels for a vehicle?


Alessandro
 Share

Recommended Posts

Hello,

 

since I need to make a realistic vehicle, I wanted to create it using Newton joints.

I'm not so experienced in LE, so I started using DRIVER.LUA (just to get a guideline).

Now I notice that such script uses CreateObject() to create the vehicle (chassis is the only real physics thing).

Instead I need to create chassis + wheels (as BODY in order to apply sliderJoint).

I cannot find the right way to start from.

After the user start the program, the object chassis will be created:

 

function class:CreateObject(model)

 

Then...

 

local object = self.super:CreateObject(model)
object.vehicle = CreateVehicle(object.model)

 

Ok, where and how can I load wheel physics? In the original code the wheels do not exist as physic entities. Do you suggest me to create separated tire and its related PHY file?

Or can I use the tire already stored in the vehicle model ( see VIPER as an example)?

 

Please highlight my dark way :blink: since I'm very confused.

 

Thank you for your help!

Link to comment
Share on other sites

You can use wheels with a physics model and still do it like in the driver.lua example. The wheels will collide with things just fine, but of course they won't get any force impact back since you use SetEntityMatrix() on them which eliminates reverse physics force. But collisions still work fine.

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 ■

Link to comment
Share on other sites

You can use wheels with a physics model and still do it like in the driver.lua example. The wheels will collide with things just fine, but of course they won't get any force impact back since you use SetEntityMatrix() on them which eliminates reverse physics force. But collisions still work fine.

 

Please can you better explain me what you mean?

Link to comment
Share on other sites

Just do it like in the driver.lua example, but replace LoadMesh() for the wheels with LoadModel() in vehicle_viperscout.lua, and add physics bodies to your wheel models. Nothing else needed.

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 ■

Link to comment
Share on other sites

No, it doesn't affect the car behavior, it only adds more realistic collisions for the wheels when you collide with other loose objects. You can adjust some car behaviors with the spring dampening settings.

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 ■

Link to comment
Share on other sites

LE doesn't use Newton's car, although I think it would be better. However, it seems to be possible also to use Bullet in LE, I'm playing around with that.

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 ■

Link to comment
Share on other sites

Hello, I finally tried to implement your suggestion, but not work. In fact, if I do not apply EntityType for collision, then nothing changed (car behaviour does not change), instead if I apply entitytype as:

 

EntityType(object.tire[n], 1)

 

Well, LE hangs (slow down the entire engine!).

 

I think it is logical, since vehicle built functions created by Josh use a different way (rays) to simulate wheels collision, so I think those methods go in conflict.

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...