Wheel location/rotation

context:
using Libbulletjme, not minie, not JMonkeyEngine
I’m also not particularly used to java or Javadoc’s
the code is being reflected by a DSL
made variables bold

Issue:
when using most objects i can just use
object.getPhysicsRotation(quaternion)
object.getPhysicsLocation(vec3f)
which gives me the location/quaternion as variables i can use
but this does not work for wheels.

i found documentation for location/rotation of wheels but it just returns default values
wheel.getWheelWorldRotation(quaternion)
seems to return (0.0, 0.0, 0.0, 1) and im not sure why
vec = wheel.getWheelWorldLocation(vec3f)
getWheelWorldLocation returns (0.0, 0.0, 0.0)
my current imports for this code are

com.jme3.bullet.PhysicsSpace
com.jme3.bullet.collision.shapes.CompoundCollisionShape
com.jme3.bullet.collision.shapes.BoxCollisionShape
com.jme3.bullet.collision.shapes.PlaneCollisionShape
com.jme3.bullet.objects.PhysicsRigidBody
com.jme3.bullet.objects.PhysicsVehicle
com.jme3.bullet.objects.VehicleWheel
com.jme3.math.Plane
com.jme3.math.Quaternion
com.jme3.math.Vector3f
com.jme3.system.NativeLibraryLoader

My recollection is that the JME vehicle demo animates the wheel spatials, including then turning left/right… so you might be able to look at that to see how it does it.

1 Like

cant find anything in the examples, but i maybe skimming past it
which one are you refering to?
its also just the physics engine some things may not be applicable

my current workaround is it takes the main bodys location, visually offsets the wheels by the connection points, then makes a quat that rotates/spins them
but they are locked in place relative to the vehicle, it looks accurate enough besides lack of suspension and if the car flips the wheels stay on the ground… :stuck_out_tongue:

There is some demo where you can drive a little ferrari around on a flat plane. It’s either in the examples or in the JME test applications.

Yes, but somehow that demo knows where to draw the tires by asking the physics engine.

It took me two seconds to find it because I looked in “engine wiki” → “physics” → “vehicles”

im noticing “Spatial” coming up alot in minie/jme
but not in libbulletjme besides the occasional reference
if the spatial is how the wheel is being visualized i don’t have access to it

this makes it sound like the physics object and spatial are separate

“Physics objects remain in the physics space when their spatials are detached from the scene graph!”

this makes it sound like the spatial is a visual that can be desynced with the physics location

“remember the physics space still runs in world coordinates so you can visually detach things that will actually still collide in the physics space.”

this refers to the wheel being visualized by one

"public com.jme3.scene.Spatial getWheelSpatial()
Access the scene-graph subtree used to visualize this wheel."

code also uses nodes which i guess bullet does not understand

Bullet always uses world coordinates, there is no such concept as nodes so the object will be moved into a world location with no regard to its parent spatial.

if my understanding is a spatial is a location/rotation/visual/data to use in JME that can be attached to something and in reference to it, like adding a wheel visually offset by a vector/rotation from the vehicle, i dont think i can use it.

it seems like I’m trying to make Spatial replacements inside of another game using whatever i can pull from libbulletjme

that or I’m INCREDIBLY wrong, and cant figure out where the code pulls the wheel locations

Spatials are spatials.

Physics is physics.

Something moves the transforms over to the spatials. As you indicate previously, it must be so. Spatials don’t know anything about physics after all… and yet, somehow, there they are where the wheels are.

Maybe step around in a debugger if you can’t read the code to investigate that way.

maybe try:
wheel.getWheelInfo

or possibly even:
wheel.getWheelInfo.worldTransform