Problem with tween

myOrbit.prototype.update = function() {
vysledek = oldNumber.x - number.x;
var tweenPlus = entity.tween(entity.getLocalRotation())
.to({x: getLocalRotation().x, y: getLocalRotation().y + vysledek/10, z: getLocalRotation().z}, 1.0, pc.SineOut);
tweenPlus.start();
};

// and i got this error ->entity.getRotation is not a function

There is some more code with these variables, but it is necessary in this case.

As you are not calling getRotation in the code you have shown, are you sure that the error is from that code block?

Can you share a link to the project that showcases the error?

yes, i am sure.

here is link
https://playcanvas.com/project/556605/overview/test

I couldn’t get the error to happen. Is there a button or an action I need to do to trigger the tween?

just click and hold with the left button and move mouse

I had a look at the project and there seems to be a misunderstanding of scope.

Taking this snippet:

var myOrbit = pc.createScript('myOrbit');


// initialize code called once per entity
myOrbit.prototype.initialize = function() {

    this.app.mouse.disableContextMenu();
    this.app.mouse.on(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);
    this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
    this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this);
};

this.isPressed = false; // *a
this.number = 0; // *a
this.oldNumber = 0; // *a
this.entity = this.entity.parent; // *a

myOrbit.prototype.onMouseMove = function(event){
    number = event; // *b
};

The lines where I have // *a next to them, you have created the variables in global scope and not class scope because they are outside the class definition (i.e any of the class functions).

The line where // *b next to it, you have also created a variable in global scope.

I believe this is what you actually intended (everything in class scope)

var myOrbit = pc.createScript('myOrbit');


// initialize code called once per entity
myOrbit.prototype.initialize = function() {

    this.app.mouse.disableContextMenu();
    this.app.mouse.on(pc.EVENT_MOUSEMOVE, this.onMouseMove, this);
    this.app.mouse.on(pc.EVENT_MOUSEDOWN, this.onMouseDown, this);
    this.app.mouse.on(pc.EVENT_MOUSEUP, this.onMouseUp, this);
    
    this.isPressed = false;
	this.number = 0;
	this.oldNumber = 0;
	this.entity = this.entity.parent;

};


myOrbit.prototype.onMouseMove = function(event){
    this.number = event;
};

You are also missing the tween library found here: https://github.com/playcanvas/playcanvas-tween

I’ve fixed up the project as much as I could without knowing what you wanted as an end result: https://playcanvas.com/editor/scene/618475