setRotation() doesn't work for camera entities?

The title pretty much sums it up. setPosition() works as one would expect, but setRotation appears to do… nothing?

Here’s the relevant code snippet in question:

    var a = app.root.findByName("User Camera"),
    b = app.root.findByName("Camera Preset 1");

    a.setPosition(b.getPosition());
    a.setRotation(b.getRotation());

setPosition, again, works - but setRotation does not; Further, the value is set, but the camera doesn’t update after it’s set (unlike setPosition, which updates immediately).

Does anybody know what would cause getRotation to fail silently?

Does the following work:

    a.setEulerAngles(b.getEulerAngles());

Can you share a minimal scene that illustrates the problem? That’s the beauty of PlayCanvas - you can just share a link to a problem! :wink:

Hello, something like this ?
var q = new pc.Quat(b.getRotation());
a.setRotation(q);
But I think what Will said is better.:grinning:

Sadly, I tried all manner of the following, with no avail:

a.setRotation(b.getRotation());
a.setLocalRotation(b.getLocalRotation());
a.setEulerAngles(b.getEulerAngles());
a.setLocalEulerAngles(b.getLocalEulerAngles());

The values for those keys updates, but the camera in question doesn’t get updated :frowning:

Will: The scene I’m working in is kind of “top secret”, but you’ve been in there before - I could PM you a link to the scene, if you’d like? Easier than setting up a new scene and such :slight_smile:

Well, you could have created a scene like this:

https://playcanvas.com/editor/scene/468581

But I’ve done it for you because I’m a nice guy like that. :wink:

As you can see, it works fine (press ‘space’ when running the app).

1 Like

Very peculiar… then the failure is definitely on my side :slight_smile: Thank you for the effort and the insight - I greatly appreciate it :slight_smile: