viromedia / virocore

ViroCore cross-platform AR/VR renderer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node's transforms too slow (i.e. setPosition, setRotation)

fzaiatz opened this issue · comments

Hi there! We're trying to generate a new Node animation model (AnimationTransaction's does not fit 100% our needs).

The approach so far is:

  1. Set ViroView's setFrameListener
  2. On each frame, update each Node's position, rotation, scale and opacity

For this we've created a component-oriented approach. From a design point of view everything is working as expected.

The problem we're having is when we call each Node's native setPosition/setRotation/setScale methods. Each call takes around 300ms (on a Samsung Galaxy S8).

Taking a look a bit further at Node's setPosition (for example):

public void setPosition(Vector position) {
    this.nativeSetPosition(this.mNativeRef, position.x, position.y, position.z);
    this.updateWorldTransforms();
    this.updateAllUmbrellaBounds();
}

Where nativeSetPosition calls setPositionAtomic (Node_JNI.cpp). Is there any way this could be changed, in order to update Node's props immediately?

Thanks!

Hey @fzaiatz, could you explain what you are trying to do? Are you trying to call setPosition and then getPositionRealtime immediately? (Which is why you ran into this case)

Hi @dthian :)
Well, not exactly. I need a way to animate a Node’s position frame by frame, and by calling setPosition we can’t make it work (around 300ms each call)