Sign in to follow this  
cx20

OimoJSPlugin's setLinearVelocity is incorrect

Recommended Posts

I tried to create a sample using OimoJSPlugin.

http://jsdo.it/cx20/IVHj

However, the following error occurred.

Uncaught TypeError: impostor.physicsBody.linearVelocity.init is not a function
    at OimoJSPlugin.setLinearVelocity (babylon.max.js:85118)
    at PhysicsImpostor.setLinearVelocity (babylon.max.js:83249)
    at IVHj:264
    at Array.forEach (<anonymous>)
    at Observer.callback (IVHj:260)
    at Observable.notifyObservers (babylon.max.js:8294)
    at Scene.render (babylon.max.js:27859)
    at IVHj:78
    at Engine._renderLoop (babylon.max.js:12784)

Perhaps linearVelocity and angularVelocity should use the set function, not the init function.

        public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {
            //impostor.physicsBody.linearVelocity.init(velocity.x, velocity.y, velocity.z); // init() is undefined
            impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);
        }

        public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {
            //impostor.physicsBody.angularVelocity.init(velocity.x, velocity.y, velocity.z); // init() is undefined
            impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);
        }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.