Start a new topic
Solved

Javascript iOS 3D Object manipulation jerky

Hello,


I'm trying to scale and rotate a 3D object with gestures. I used the example 3D Model Interactivity as startingpoint. On a Android HTC One it's working fine, on a iPhone 6s its really jerky. Sometimes the manipulations aren't processed at all or only after another interaction.


I also tried a simple cube instead of the Lamborghini, but there was no improvement.


SDKs: Javascript Android & iOS 6.0


Thanks!
onLoaded: this.loadingStep,
scale: {
x: previousScaleValue,//0.1,
y: previousScaleValue,//0.1,
z: previousScaleValue//0.1
},
translate: {
x: 0.0,
y: 0.05,
z: 0.0
},
rotate: {
z: previousRotationValue
},
onRotationChanged: function(angleInDegrees) {
//this.rotate.z = previousRotationValue + angleInDegrees;
this.rotate.z = previousRotationValue - angleInDegrees;
return true;
},
onRotationEnded: function(angleInDegrees) {
previousRotationValue = this.rotate.z;

return true;
},
onScaleBegan: function(scale) {
return true;
},
onScaleChanged: function(scale) {
var scaleValue = previousScaleValue * scale;
this.scale = {x: scaleValue, y: scaleValue, z: scaleValue};

return true;
},
onScaleEnded: function(scale) {
previousScaleValue = this.scale.x;
return true;
}

Hello Florian,

Since you mentioned that you are testing with our SDK 6.0 I would recommend that you start testing with our latest version, which is Wikitude SDK 6.1. Is our sample working for you and you only experience these issues when you test with your app? If so, could you please share a video with us demonstrating the problem you are facing?

Thanks
Eva

 

Hello Eva,


thank you for your answer. This time, i tried version 6.1, but no improvement. 

Your sample is working (3D model - interaction) but there is only rotation via button, not with gestures.

So i only added the following lines of code:


var previousRotationValue = 0;

var previousDragValueY = 0;

var previousDragValueX = 0;

var previousScaleValue = 0.05;

 

//in this.modelCar = new AR.Model("assets/car.wt3"


...


onRotationChanged: function(angleInDegrees) {

  this.rotate.z = previousRotationValue - angleInDegrees;

  return true;

},

onRotationEnded: function(angleInDegrees) {

  previousRotationValue = this.rotate.z;

  return true;

},

onScaleBegan: function(scale) {

  return true;

},

onScaleChanged: function(scale) {

  var scaleValue = previousScaleValue * scale;

  this.scale = {x: scaleValue, y: scaleValue, z: scaleValue};

  return true;

},

onScaleEnded: function(scale) {

  previousScaleValue = this.scale.x;

  return true;

}

 

You can find the video here:

https://www.dropbox.com/s/4xwxk2u8idvicwq/2017-04-19%2017.25.56.mov?dl=0


Thank You,

Florian

Hello Florian,

Since you want to use gestures to interact with your 3D model then, I would suggest that you have a look at our Gesture sample and start with that. I will test internally your app, based on the code you provided, but can you also test our Gesture sample and Instant Tracking sample on the iPhone 6s and see if you are still having issues with our samples?

Thanks
Eva

 

Hello Eva,


I used Gesture with AR.Model instead of AR.ImageDrawable and it worked fine on the iPhone 6s. But i don't see the difference between my sourcecodes, which affects this unintended behaviour.


I did many changes to the 3D Model - interactivity.js so I don't want to start once more from scratch. 

js
(8.57 KB)
js

Hello Eva,


thank you for your help. I solved the problem. These lines in the index.html did the trick:


<!-- disables pinch-scaling of the webview, so that gestures only do what they're supposed to -->

        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />



Hello Florian,

I am happy you were able to solve your issue and thank you for posting your solution here so that other users can see it as well.

Eva

 

Login or Signup to post a comment