A new fork of the engine


I tested it in the latest Dragon build today. It’s working in this build. Therefore all is good. In fact, my baby is falling the same! And all lights are sames. Cross compatibility yay!!

Like I don’t need the Record Animation button if UPBGE gives me a realistic real-time render for what my baby will “see” and therefore for my working viewport and for my Movie of my baby AI sim to show people. But, why exactly can’t the button be in UPBGE? More buttons makes us happy bro…I’ll pay yous like 70usd to add the button “Record Animation” back… Just it’s important to me and I want to know why it can’t be in UPBGE…there’s plenty of room for it…

(Nemescraft) #1042

Hello, I’ve installed UPBGE 0.1.9, and tried to make a vehicle using that new function. It works weird, but my main issue is that when I press “Esc” to quit the game, UPBGE crashes and closes instantaneously.

Here is my code:

from bge import logic, constraintsimport mathutils

cont = logic.getCurrentController()
scene = logic.getCurrentScene()

own = cont.owner

vehicle = constraints.createVehicle(own.getPhysicsId())

for wheel in scene.objects:
    if "Wheel" in wheel.name:
        wheelPos = wheel.localPosition
        downDir = mathutils.Vector((wheelPos.x, wheelPos.y, wheelPos.z - 5.0))
        axleDir = mathutils.Vector((wheelPos.x + 1.0, wheelPos.y, wheelPos.z))
        #create the wheel
        vehicle.addWheel(wheel, wheelPos, downDir, axleDir, 1.0, 1.0, False)

And the .blend file:


VehicleWrapperTest.blend (450 KB)

(Akira_San) #1043

Its best to report bugs/issues on github tracker. The devs are not very active on the forum.

(BluePrintRandom) #1044

this is interesting

instant cycles

(Lostscience) #1045

I tested your blendfile and the same thing happened to me.

(Nemescraft) #1046

@Akira_San I posted on GitHub, although I found that this issue already existed, and it was marked as “bug” and “cannot be fixed” :frowning:

@Lostscience Looks like a bug where UPBGE crashes with some code. I disabled the script and then it didn’t crash…

(Akira_San) #1047

I think you should make a new issue. You made a reply in the issue with the notebook bug.
I tested the file and got a crash too. I used latest master build.

(tristan73) #1048

@Nemescraft: In your example file you are calling the script every frame and so creating again constraint with the same vehicle and wheels, this should be avoided. After this you can see that the down and axis direction of your wheels are not correct.

(Nemescraft) #1049

@tristan73 yes, I realised after some time. But I still don’t understand the down and axis directions… So then it is not a bug?

(Momel) #1050

The directions are as following:

downDir = [0, 0, -1]
axleDir = [-1, 0, 0]

Btw, you don’t need mathutils.Vector for that, lists work as well.

Because downDir should point towards the ground, we put in 0 for x and y and let z be -1.
And because the axis of the wheels is parallel to the x-axis of the chassis, we set that to -1 (or any other value > 0) and y as well as z to 0.

I had the same problem a few days ago because i misunderstood the documentation:

axleDir (vector of 3 floats) – The axis the wheel rotates around, relative to the chassis.

Relative to the chassis doesn’t mean the position, it means that the axes are local (relative to the chassis). So if you want to use the x-axis of the chassis for your wheel axis, you set it to [1, 0, 0]

Unfortunately the wheels are not in the right position now, but i don’t know how to fix that.
I think wheelPos should be wheel.worldPosition - own.worldPosition because you want the position relative to the chassis, but this doesn’t work as well :frowning:

(BluePrintRandom) #1051

local = wheel.Position - chassis.worldPosition
local = chassis.worldOrientation*local

(Nemescraft) #1052

What do you mean by “.Positon”? WorldPosition or LocalPosition?

I used the wheel’s local position because it is the position relative to its parent, the chassis, because when you parent it when the chassis is at 0.0, 0.0, 0.0 the wheels’ positions are correct. Also, the physics visualization is correct, it is the wheels that are weird.

Here is the new .blend: (it might be a better idea to start a new thread though)


VehicleWrapperTest.blend (451 KB)

(BluePrintRandom) #1053

here is a working example of the vehicle script

spacebar = applyForce

from bge import logic, constraints
import mathutils
from mathutils import Vector

cont = logic.getCurrentController()
scene = logic.getCurrentScene()

own = cont.owner
chassis = own
space = cont.sensors['Space']

vehicleID = own.getPhysicsId()

if not "init" in own:         
    vehicle = constraints.createVehicle(vehicleID)
    for wheel in chassis.childrenRecursive:
        if "Wheel" in wheel.name:
            wheelPos = wheel.worldPosition-chassis.worldPosition
            wheelPos = chassis.worldOrientation.inverted()*wheelPos
            downDir = [0.0, 0.0, -.5]
            axleDir = [-1.0, 0.0, 0.0]
            #create the wheel
            vehicle.addWheel(wheel, wheelPos, downDir, axleDir, 0.2, 1.0, False)
            print('added wheel at '+str(wheelPos))
    own["init"] = True
    if space.positive:
        vehicle = own['Vehicle']
        for wheel in range(vehicle.getNumWheels()):
            vehicle.applyEngineForce(86, wheel)


VehicleWrapperTest_Bpr_fix.blend (489 KB)

(Nemescraft) #1054

Ah… I think it was the parenting that caused the wheels to move upwards…

EDIT: Thanks, it works!


When will UPBGE get PBRs for real-time photorealism?

How hard is it for yous to make PhysX an optional Physics Engine / plugin for UPBGE? Bullet Physics *may be better, however it lacks liquid/gas/molecules.

(JustinBarrett) #1056

PhysX is not open source AFAIK. and They have been actively working on getting UPBGEevee, or whatever they will call it, up and running.

However, I cannot speak for the UPBGE team.


But are they going to give the Game Engine PBRs…OR, are they hoping that they will be allowed to, much later, smack it into 2.8 and only then get it to have PBRs by intergrating with EEVEE’s PBRs?

I mean, are they for-sure going to do it to *their program UPBGE / or have the source (or whatever)? Or, are they hoping to get it at 2.8 integration?

(Akira_San) #1058

Yes, they are gonna use the Eevee shading to give a PBS to UPBGE. Since UP/BGE is using the viewport shading code, that is gonna get replaced for 2.8. I would suggest for the upbge devs to wait 2 months before continue working on 2.8. Well thats how i think. It my opinion, since the roadmap says, that a cluster lighting is gonna get added and a lot of code then is gonna change. So yeah, its my opinion. :slight_smile:


Oh and another important question. Is this realistic render going to be for only VIEWPORT, or, is it during when playing your video game / simulation? The later is more important, because although a nice work-viewport is helpful+fun, realistic game/simulation Render is much more useful, actually even more fun+helpful.

(Akira_San) #1060

The viewport is using PBS shading. The shading is shared between the viewport and game engine.