Jump to content

OimoJSPlugin's setLinearVelocity is incorrect


cx20
 Share

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);
        }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...