I try this code:
MouseInput.prototype.onMouseWheel = function (event) {
this.orbitCamera.distance -= event.wheel * this.distanceSensitivity * (this.orbitCamera.distance * 0.1);
event.event.preventDefault();
};
and works But it not use physics i need use torque in my entity with scroll Any idea?
Hi @Luis_Mb,
You can use that value to apply a torque to your body in a direction:
var torque = new pc.Vec3(0, this.orbitCamera.distance, 0);
this.entity.rigidbody.applyTorqueImpulse(torque);
2 Likes
Thank You @Leonidas for quickly answer… I have tried this. I am some confused 
var Test = pc.createScript('test');
Test.prototype.initialize = function() {
var mouse= this.app.mouse;
this._mouseWheelChange = 0;
mouse.on(pc.EVENT_MOUSEWHEEL, function (e) {
this._mouseWheelChange = e.wheelDelta;
}, this);
};
Test.prototype.update = function(dt) {
//this.entity.translate(0, this._mouseWheelChange * dt * 5, 0);
// this.entity.rigidbody.applyTorque(0,this.mouseWheelChange * dt * 0.01, 0);
var torque = new pc.Vec3(0, this.orbitCamera.distance, 0);
this.entity.rigidbody.applyTorqueImpulse(torque);
this._mouseWheelChange = 0;
};
Test.prototype.onMouseWheel = function (event) {
this.orbitCamera.distance -= event.wheel * this.distanceSensitivity * (this.orbitCamera.distance * 0.1);
event.event.preventDefault();
};
Why are you using the camera distance for torque?
Hi @yaustar.
I used this script before, for another move, and now I’m trying to edit it to include torque physics
It’s just weird to use as distance is always positive so it will just keep spinning in one direction.
Thanks. I have finished the code. Now works perfect 