changeRotation() {
if (this.activatedObject) {
if (this.degX == null) {
this.degX = this.prevDegX;
}
if (this.degY == null) {
this.degY = this.prevDegY;
}
if (this.degZ == null) {
this.degZ = this.prevDegZ;
}
this.degX = this.prevDegX = this.checkLimitBeforeApplyForInputSlider(Math.round(this.degX), 63, -63);
this.degY = this.prevDegY = this.checkLimitBeforeApplyForInputSlider(Math.round(this.degY), 63, -63);
this.degZ = this.prevDegZ = this.checkLimitBeforeApplyForInputSlider(Math.round(this.degZ), 63, -63);
if (_.isNumber(this.degX) && _.isNumber(this.degY) && _.isNumber(this.degZ)) this.activatedObject.rotation.set(this.degX / 10, this.degY / 10, this.degZ / 10);
this.renderCanvas();
}
}
It might be that the object’s origin is not in the center of the object.
2 Likes
How to do can you help me in this?
I’d suggest you read up on 2D transformations in computer graphics first. If you understand that, 3D is merely an extension of the same principles. Try this for starters.
Note, how the only point, which does not change its position during a rotation is at the center of rotation.
hofk
November 7, 2024, 5:21pm
5
If it is because the model is not centered, this simple example may help you.
LoadGLTFmove
See also BeginnerExample step 3 (line 250 … 269 )
( from the Collection of examples from discourse.threejs.org )
Hello your beginnerExample is under construction Can you suggestion changes in my code
I have mentioned my code in this. Can you help find the which changes i should changes. because i can’t understand any in computer graphics theory
When I object rotation or Scalling with that control then why its change’s position also, See below Video
I want to below video result in my current code
In older packager version its perfect working but new version not work
Older Version: “^0.96.0”
Newer Version: “^0.167.1”,
This is my three js environment setup code
// canvas initialization
async init() {
await this.addScene();
await this.addRenderer();
await this.addCamera();
await this.addLight();
await this.a…