Remove Vehicle

Interesting…
because I tried exactly the same method and the result was crash blender.

If you want to remove everything, start removing the constraint,

Really??

In this thread removing cons. was the problem.
It was no possible way to do this before Moguri solve this.
If you did that by otherwise so enlighten me.

Moguri:

Fix T37040: Removing vehicles in BGE causes a crash
The vehicle constraint is now properly removed if bge.constraints.removeConstraint()
is used or the object is deleted. This also fixes a memory leak with the
vehicle wrapper.

@ Fluppi393: In the blend I attached you can see that Blender crashes, even if you remove the constraint first. This was actually the bug description when it was committed in the bug-tracker. So I’m also curious why you didn’t have this problem.

Yes I also had that problem that Blender crashed, but on my Blender 2.69 I can simply delete the wheels and the car itself, without crashing.
And I am not sure wether you knew that, but in your script it seems like you tried to remove the car before removing the wheels, wich does obviously not work since your car object cannot delete the wheels after it doesn’t exist anymore.

PS.: Sorry for that little confusion, I did not realize that there is a 2. page of this thread when I wrote my answer!

A little late but wanted to straighten something out. The API explains about endObject() that the actual removal of the object from the scene is delayed (with one logic tic I assume). So all lines of code that follow next will still run. So you would know.

Ohh I am sorry I didn’t know that :open_mouth: Was that a patch because I remember a lot of cases my scripts didn’t work because the object was ended before it was supposed to do something and it didn’t…

But anyway, removing all wheels and the car without removing the constraint itself works fine for me!
Does that crash Blender for you?

Yes, it’s very strange it doesn’t crash with you. Do you run Blender 2.69 on Windows 64 or 32 bit? And is it the official version or a build?

But it doesn’t really matter now, because the bug has been fixed, so I’ll be expecting it in trunk soon.

Tried that with Windows 7 64 bit and Ubuntu, both working. And I am using normal Blender 2.69.
But great to see those bugs are actually being fixed!