Remove Vehicle

Hi :slight_smile:
Recently I’m working on my vehicle system. Looks and work nice but I have big problem. I cannot remove the vehicle :frowning:
I’m tired of this:


I would be grateful for any help.

What do you mean?You mean you cannot delete the vehicle.

In my game You will can buy or sell cars. So that mean the vehicle can be add and remove from scene (realtime) I added vehicle wrap and i tried to remove that in ge but it crash blender.

What you are going to have to do i think is put the constraints on emptys and then parent them to your car, in order to add the car and remove car intact.

In vehicle wrapper emptys not help me. The bug is in wheels. The car object is remove correct but wheels are still on scene. Because the constraints is still working and don’t let them remove. What I have to do is remove the constraints before remove wheels.
I tried to do that by > PhysicsConstraints.removeConstraint(constraint_id) but this is not working :frowning:

All i can say to do is end the wheels seperately and add the wheels seperately. Add the chasis seperately and end the chasis seperately.
With the press of one keyborad key do that.It will take just a little more code.

mhm. This explains a lot. Thanks :slight_smile: But I don’t know how to that seperately.
I tried by separate script for chassis and car body>no result (I am not practised in python)

Z -key< -------(remove_chassis.py) [this remove all wheels
. ^------------(remove_carBody.py) [ and this only car body

I also tried separete scripts for all wheels and car body (also crash blender)

I don’t want to sound silly here,

but why use the vehicle wrapper at all?

Do you need a basic vehicle script?

you can have a “chassis” with 4 rigid body wheels,
and have torque on the wheels to move,
steering is as easy as matching the orientation of the spindles,
the spindles can be turned using Rot,
and the RBJ’s limits will make them follow I believe.

One sec I will pop up a demo.

ok here is a demo (it needs more tinkering to be perfect)

Attachments

TorqueMobile.blend (564 KB)

here is a more polished version

Attachments

TorqueMobile(morePolished).blend (572 KB)

Yes I know that. I made similar vehicle of 6dof also from your idea and help. The drive system was uncomfortable and losing traction for dump when was turning. Your demo is not so bad, but this is not perfect because it need lot more elements for simulating suspension. I keep this as a “plan B”.

I choose vehicle wrapper because is simple and looks so real for drive suspension.
The vehicle wrapper would be great if can simulating skid of tires and have easy way to remove.

Do you need to remove it from the scene completely? Can you just hide it and move it off to some distant coordinate?

by adjusting the 6dof limits, and adding “spring force” and using 2 “spindles” (I am only using 1)

I think you could make realistic suspension travel, and angles/camber etc

check this out

this handles pretty well,

you can edit the location of the “center” to change the rollability,

change the “torque” numbers in the back wheels (or add some in the front for 4x4)

basically I can change any setting you want, or set up any suspension linkage,

Attachments

TorqueMobile(UbberPolished).blend (559 KB)

update -




import bge
from mathutils import Vector
from bge.logic import getCurrentController


cont = bge.logic.getCurrentController()
own = cont.owner
target = own.scene.objects["center"]
m1  = own.worldOrientation
m2  = target.worldOrientation
dif = Vector((m2 * m1.inverted()).to_euler())
x = dif.magnitude
force = own['Force']
if dif &gt;0:
    Forces=dif * force/x
    own.applyTorque(dif * force/x, 0)



works much better for returning to “straight” gracefully

Why not just have have three scene overlays.Two of these scenes are without a car but have everything else in the them.And only one has the car.Remove the one with with the car.You can also add the one with the car any time in the videogame.This would work for multiplyer as well.

removing the scene would most likely crash blender as well,

You can already do that with logic bricks and the blender game engine does not crash.

@3d solar system builder
Nope, logic bricks aren’t help. True/False separete or not… it doesn’t matter. Crash,Crash :frowning:
Really? Nobody ever remove car in Bge??
I’m starting to think that VehicleWrapper was created by the creators of the blender and They didn’t thinking about removal options.

@ BluePrintRandom
Maybe “Plan B” is just so better…

It does not crash for me when i use scene overlay in the blender game engine logic bricks.
Here is the blend file.Press w to add sceneoverlay and l to remove scene. http://www.pasteall.org/blend/24471