Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fzaiatz opened this issue Nov 28, 2019 · 2 comments
Open

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

fzaiatz opened this issue Nov 28, 2019 · 2 comments

Comments

@fzaiatz
Copy link

fzaiatz commented Nov 28, 2019

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!

@dthian
Copy link
Member

dthian commented Nov 29, 2019

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)

@fzaiatz
Copy link
Author

fzaiatz commented Nov 30, 2019

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants