Skip to main content

ViewInfo.getTrackerBaseToVworld not working as one would expect

No replies
Joined: 2010-02-05
Points: 0

The newly introduced method ViewInfo.getTrackerBaseToVworld (along with underlying getTrackerBaseToViewPlatform) work only in special cases: when coexistanceCenteringEnabled is set to false or useHeadTracking is true.

In my opinion these methods should work work, whether I use headTracking or not.

In the code (class com.sun.j3d.utils.universe.ViewInfo):

I get NullPointerExp on line 1979:

ci.viewPlatformToCoe) ;

coeToTrackerBase is null cause it wasn't initialized in line 2292:

if (!coeCentering || useTracking) {
if (this.coeToTrackerBase == null)
this.coeToTrackerBase = new Transform3D() ;

env.getCoexistenceToTrackerBase(this.coeToTrackerBase) ;
if (verbose) t3dPrint(coeToTrackerBase, " coeToTrackerBase") ;

In the end one still have to do workarounds to get trackerToBase transform as in WandViewBehaviour:

protected void initAction(Sensor s) {
targetTG.getTransform(viewPlatformToVworld) ;
active = true ;
if (s == null) return ;

// Kludge to get the static trackerToVworld for this
// frame. This is computed from the two separate sensor reads
// below, which are close enough to identical to work. The
// Java 3D View class needs a getTrackerBaseToVworld() method
// (see Java 3D RFE 4676808).
s.getRead(sensorToTracker) ;
view.getSensorToVworld(s, sensorToVworld) ;

trackerToSensor.invert(sensorToTracker) ;
trackerToVworld.mul(sensorToVworld, trackerToSensor) ;